Project-Wide Toggle for Pixi.settings.ROUND_PIXELS


#1

Hello All,

I started digging into some “unique” features that Pixi added in v4 and v5 which we don’t have currently. While there are quite a few unique ones that might be neat for testing (PIXI.settings.ANISTROPTIC_LEVEL and PIXI.settings.MIPMAP_TEXTURES are some examples), one that I think would immediately be useful pretty much immediately is Pixi.settings.ROUND_PIXELS. (https://pixijs.download/release/docs/PIXI.settings.html#ROUND_PIXELS)

There is something similar in the Platformer Character behavior, but that only helps with that specific object’s movement. By enabling this at the project level, this takes care of rounding for cameras, tweens, and all object movements regardless of movement type. This method also replaces the old roundPixels=True process @Bouh and I tested with text objects.

I tried to do some digging to see where I could put this into an locally exported project, as I knew where to do it for text objects, but cannot find out where to put it into any of the various .js files to have it apply to the project, as a test.

I think it would be valuable to have this as a project properties toggle option. From the description in Pixi’s documentation “Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth.”. Eliminating subpixel rendering can be very beneficial for any project, but especially for those with retro-style movement and graphics.

I wanted to throw a post on here before I opened up a github issue, to ensure there weren’t any large objections to the general idea. (Also if anyone can identify where the heck to put it into an exported game’s .js files, I can do more testing with it.)

Is there any issues with this requests, or pitfalls I’ve missed?


#2

Would this be similar to Godot’s pixel snap which prevents sub-pixel rendering?


#3

That is my understanding, yes. It basically applies Round() to everything that has to do with position/sizing/movement/etc.


#4

Sounds like a good idea to expose this, if there are no adverse side effects effects (like it’s only affecting rendering, not the position of objects). Feel free to open an enhancement issue and that should be a good first issue/small bounty issue.
Could be very useful for pixel art games.


#5

Thanks 4ian. Created here: https://github.com/4ian/GDevelop/issues/2504


closed #6