GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Panel sprite Blur bug

Open VegeTato opened this issue 2 years ago • 6 comments

Describe the bug

Panel sprite is always blurring In this simple project, you can see, using the same asset for 2 objects with the same size • on Panel sprite: Blur • on Tiled sprite: Clean

as you can see, panel sprite is blurring, even though the project settings is set to (nearest) and the resources do not have smooth checked. resolution doesn't matter the panel is always blurring, but in this project i used 640x360 (I also tried 800x600 and its still the same) to better see this bug, use Lerp camera X at low speed and you will see the issue clearer, the slower the Lerp the cleanest you see the bug (I used 0.03 speed).

Project file

Project.zip

Other details

  • Windows 10 / GDevelop offline version
  • Latest GDevelop version
  • The bug is reported 2 years ago #1774 , but the submitter didn't give much details, and from what I see in that topic, Devs thought this issue is from wrong settings, while its actually a blurring bug that cannot be fixed from the user side (no workaround found).

Source

VegeTato avatar Jun 16 '22 17:06 VegeTato

Hi with the project did you tried to enable the round pixel option? Like: image

But I admit that if it works for the sprite, it should work for the other object too.

Bouh avatar Jun 29 '22 14:06 Bouh

Hi with the project did you tried to enable the round pixel option? Like: image

But I admit that if it works for the sprite, it should work for the other object too.

WOW after checking the option (round pixels) it works perfect now... (without the option the blur is always there) I don't understand, what exactly is round pixels for ? and why its not ON by default when you pick (nearest no anti analyzing) should i turn this option ON for all my pixel perfect games ? (even though must of my games have 0 blur because i use tile sprite object and round pixels option is off) what are the cases i should turn this option ON and when to turn it OFF ? and why while the option is OFF, tile sprite works perfect while the panel sprite is blurring ?

Thank you <3

VegeTato avatar Jun 29 '22 17:06 VegeTato

Hi with the project did you tried to enable the round pixel option? Like: image But I admit that if it works for the sprite, it should work for the other object too.

WOW after checking the option (round pixels) it works perfect now... (without the option the blur is always there) I don't understand, what exactly is round pixels for ? and why its not ON by default when you pick (nearest no anti analyzing) should i turn this option ON for all my pixel perfect games ? (even though must of my games have 0 blur because i use tile sprite object and round pixels option is off) what are the cases i should turn this option ON and when to turn it OFF ? and why while the option is OFF, tile sprite works perfect while the panel sprite is blurring ?

Thank you <3

Round Pixels was a feature added from a bounty of mine a while back. (https://github.com/4ian/GDevelop/issues/2504)

My understanding is that it is not on by default because it rounds everything. Positions, camera movement, hitboxes, etc. Some people don't like the setting because it impacts very low resolution games, especially with camera movement (since positions are always rounded, very low resolutions can look "stuttery" as it accurately reproduces old NES/SNES style games, e.g. no floating positions for the camera).

Silver-Streak avatar Jun 29 '22 22:06 Silver-Streak

Hi with the project did you tried to enable the round pixel option? Like: image But I admit that if it works for the sprite, it should work for the other object too.

WOW after checking the option (round pixels) it works perfect now... (without the option the blur is always there) I don't understand, what exactly is round pixels for ? and why its not ON by default when you pick (nearest no anti analyzing) should i turn this option ON for all my pixel perfect games ? (even though must of my games have 0 blur because i use tile sprite object and round pixels option is off) what are the cases i should turn this option ON and when to turn it OFF ? and why while the option is OFF, tile sprite works perfect while the panel sprite is blurring ? Thank you <3

Round Pixels was a feature added from a bounty of mine a while back. (#2504)

My understanding is that it is not on by default because it rounds everything. Positions, camera movement, hitboxes, etc. Some people don't like the setting because it impacts very low resolution games, especially with camera movement (since positions are always rounded, very low resolutions can look "stuttery" as it accurately reproduces old NES/SNES style games, e.g. no floating positions for the camera).

oh, but what if i want to use No rounding pixels(Off) and in the same time i want to use panel sprite without blurring just like the tile sprite object 🤷 doesn't that sounds like a bug ? that the panel sprite object does blur while the tile sprite object doesn't while rounding pixels option is off (just like the project I sent)

VegeTato avatar Jun 30 '22 00:06 VegeTato

I've looked briefly into this, so adding some info here. Thanks for sharing your project @VegeTato, I've managed to easily reproduce the seen behavior.

For info, in the engine, the checkbox "Round pixels when rendering" does 2 things:

  • Round the position of the PIXI containers when they're updated, so that their precision is more predictable and they don't look like jumping left and right when the camera moves
  • Add the PIXI option PIXI.settings.ROUND_PIXELS = true which from the doc (https://pixijs.download/dev/docs/PIXI.settings.html#ROUND_PIXELS) does something similar on the objects.

I've noticed that the 1st thing does not affect the blur of the sprites, however the second one does indeed.

I haven't looked into tile sprites, but maybe there is an automatic rounding somewhere that should not happen to be consistent?

ClementPasteau avatar Jul 01 '22 14:07 ClementPasteau

I haven't looked into tile sprites, but maybe there is an automatic rounding somewhere that should not happen to be consistent?

As far as I know, PixiJS has had an issue related to rounding positions and Tiled Sprites for a few years now. Sometimes it leads to blurring, sometimes it leads to weird lines appearing: https://github.com/pixijs/pixijs/issues/7166

Silver-Streak avatar Jul 01 '22 15:07 Silver-Streak