Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Strange artifact on scaled png  (Read 11544 times)

0 Members and 1 Guest are viewing this topic.

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Strange artifact on scaled png
« on: March 02, 2016, 03:00:49 PM »

Hello,
Recently, I've been noticing strange things happening on the transparent pngs I use for my game when they are scaled by the engine.
Here is an exemple:

My main character has subframes for animations (turning the head, blinking,...):


Sometimes, when the character is scaled in-game, strange lines appear on the edges like this:





(those images are screenshots from the game. I've created a scene with a white background so the problem is easier to spot)

You can see there is no strange line on the 100% size. They appear only when the character is scaled.

Also:
- it happens when transparent png are downscaled but also when they are upscaled.
- on my example it happens on subframes but I also saw it on single sprites with no subframe.
- it happens when I play the debug version from Project Manager but also when the game is compiled.
- it doesn't happen all the time but only from time to time.

I have no idea where it comes from!
And I don't how to solve it.
So if you have any idea, it would be wonderful!
Many thanks in advance.
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Strange artifact on scaled png
« Reply #1 on: March 02, 2016, 10:14:45 PM »

Have you tried to launch your game on another PC? Those lines seem caused by the video card, or eventually its driver.
Another test I would do, temporarily try changing sprites, with and without subframes.
This to figure out if it is my problem or a small bug.

Valter
« Last Edit: March 02, 2016, 10:21:29 PM by valter.home »
Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: Strange artifact on scaled png
« Reply #2 on: March 03, 2016, 09:13:11 AM »

Is this happening with WME or WME lite? And does enabling resp. disabling the "pixelperfect rendering" option in WME lite make a difference?

We saw similar issues (not the same issue exactly though) with WME lite on Windows using Direct3D. OpenGL behaved better on this, but had other issues. Finally we kept Direct3D as default.


Logged

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Strange artifact on scaled png
« Reply #3 on: March 04, 2016, 06:11:05 PM »

Many thanks for your answers!

Have you tried to launch your game on another PC? Those lines seem caused by the video card, or eventually its driver.
I've made a few tests today on another computer and, unfortunately, I saw the same lines...

Another test I would do, temporarily try changing sprites, with and without subframes.

I've changed the character, using one single sprite instead of several subframes.
The lines were still there when the character was upscaled.
(but I didn't see them when the character was downscaled)

Is this happening with WME or WME lite?
The lines always appear with WME.
I remember seeing them with WME lite too.
But I've made a test today with WME lite today and there was no line on the character. (but there was still some lines on the upscaled transparent png used as a foreground in the scene.

And does enabling resp. disabling the "pixelperfect rendering" option in WME lite make a difference?
Ah, I'm sorry I'm more an artist than a programmer so I'm not sure how to do that.
The WME lite I use is the one you sent me 2 years ago (when I was having this aliasing problem and it perfectly solved it).

Does the changes you suggest have to be done in the settings.xml file?


Oh I forgot to say: the lines appear and disappear when the scale change.
Per example when the character is 50% there are no lines.
At 60% you see the lines. But at 70%, no lines...
(I don't know the exact scale percentage so I used random numbers)

Many thanks again for your help!
Logged

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Strange artifact on scaled png
« Reply #4 on: March 04, 2016, 06:18:22 PM »

Can you upload the png file of the character? I've seen this happening in the past with scaling when some pixels are left in the transparent areas.
Logged
fl*p

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Strange artifact on scaled png
« Reply #5 on: March 04, 2016, 06:55:16 PM »

Have you tried to simply use molly without using characters created by other software?
I am currently working on a 2.5D game but I have never seen these lines even on personal sprite.
If it does not happen with molly it is a good starting point to find the problem ...
Logged

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Strange artifact on scaled png
« Reply #6 on: March 04, 2016, 09:32:52 PM »

Can you upload the png file of the character? I've seen this happening in the past with scaling when some pixels are left in the transparent areas.

Here is the head you see in my 3rd image. When scaled, it sometimes has lines on the bottom:
http://thecoralcave.com/stock/forums/pngproblem04.png

And here is a sprite of the entire character. Lines also appear on this one when it's scaled but there are more subtle:
http://thecoralcave.com/stock/forums/pngproblem05.png

Have you tried to simply use molly without using characters created by other software?
If it does not happen with molly it is a good starting point to find the problem ...

I've created a new actor and left the default sprites (it wasn't Molly but the pink cowboy).
There was no line.
It's a good news indeed: there's probably a problem with my png so it should be easier to fix.

Thanks a lot for your help!!!
Logged

odnorf

  • w00t?
  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 7
  • Offline Offline
  • Gender: Male
  • Posts: 1456
  • Lamp dog!
    • View Profile
Re: Strange artifact on scaled png
« Reply #7 on: March 04, 2016, 10:29:08 PM »

I can't see any problems with the files. Too bad it's not the usual issue (leftover pixels) Try to save them from another program.

I can't create a project atm to test it. if you can upload a compiled scene with the character (include also the exe) I could test it on a couple of computers.
Logged
fl*p

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Strange artifact on scaled png
« Reply #8 on: March 04, 2016, 11:22:59 PM »

I can't see any problems with the files. Too bad it's not the usual issue (leftover pixels) Try to save them from another program.

I can't create a project atm to test it. if you can upload a compiled scene with the character (include also the exe) I could test it on a couple of computers.
OK, thank you!
I'll upload a compiled scene tomorrow morning.

I may have a clue.
I've made a test with 2 sprites:
http://thecoralcave.com/stock/forums/pngproblem06.jpg
On the left: there is empty space between the edge of the png and the edges of the drawing (green arrows).
On the right: there is no empty space between the edge of the png and the edges of the drawing (red arrows).

Then, I put those to sprites in a scene (using "add sprite entity") and I set their scale to 200%:
http://thecoralcave.com/stock/forums/pngproblem07.jpg
As you can see, strange lines appear on the second sprite (red arrows on the right) while the first sprite is OK.
(in fact, a very subtle line is barely visible in game, where I've drawn green arrows. But it's totally invisible on the screenshot)

Do you think there's a logical relation between those lines and the way I cut my pngs?
I usually try to remove as much empty space as possible when I cut my pngs.
Maybe it wasn't a good idea after all...
« Last Edit: March 04, 2016, 11:24:38 PM by Atelier Sentô »
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Strange artifact on scaled png
« Reply #9 on: March 05, 2016, 09:10:27 AM »

I too have always reduced as much as possible my PNG without issues.
In any case you say that even the sprite where you left edges has a very thin line, I don't think that the problem is how you cut sprites.
You always use the same software to save your PNG?
Logged

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Strange artifact on scaled png
« Reply #10 on: March 05, 2016, 12:12:39 PM »

You always use the same software to save your PNG?
I use photoshop to save my png. But I've tried with an old version and with a recent one. And the lines appear in both cases.

if you can upload a compiled scene with the character (include also the exe) I could test it on a couple of computers.

Here is a compiled scene:
http://thecoralcave.com/stock/forums/game_png_problem.zip
It's a white background where you can walk. At the top, the character scal is 20% and at the bottom 200%.
I hope it will help.

Many thanks for your help!!!
« Last Edit: March 05, 2016, 12:16:50 PM by Atelier Sentô »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Strange artifact on scaled png
« Reply #11 on: March 05, 2016, 01:07:52 PM »

There's actually quite a simple workaround - leave a few empty pixels around your image (actually one pixel should be enough). Because those artifacts are actually the black pixels from the other side of the image bleeding in (don't aks me why, it's related to how the 3D hardware treats the textures).

I tested it on your project, and it fixes the problem.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Atelier Sentô

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 52
    • View Profile
    • Atelier Sentô
Re: Strange artifact on scaled png
« Reply #12 on: March 05, 2016, 01:24:52 PM »

Thanks a lot for the answer!
I'm going to correct all my sprites (there's a lot of them so it may take some time).
Then I'll come back to say if the problem is totally solved.
And hopefully it will.

Thanks again!
Logged
 

Page created in 0.023 seconds with 24 queries.