How to apply sharp-bilinear filter / fix pixel wobble on pixel art?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Adam Gausmann

I’m experiencing some “wobbling” when my pixel art is scaled at non-integer factors. What’s happening is that each pixel on the texture doesn’t correspond to an exact integer number of physical pixels, and so they get “rounded” to the nearest pixel. That can make some pixels look non-square and wider/taller than others.

Restricting scaling to integer values seems to be a solution in some cases, but that won’t work for me, I want to be able to set the zoom/scale to any real value and have an accurate representation of the pixel sizes on a sub-physical-pixel level.

This is a well-known problem with pixelated rendering and has been solved before. What you have to do is filter the physical pixels that lie on boundaries between texture pixels, so they get a portion of the colors from each pixel that they partially contain. This is sometimes called “sharp bilinear”.

For reference, here is a shader for RetroPie that implements this kind of filtering, and a great video about the problems with plain nearest-neighbor.

Does Godot have a feature like this? If not, what can be done about this? Would it be possible to implement this as a part of my Godot project? Would it be reasonable to implement this in the core/engine itself?

Just out of curiosity I ask: This is not solved with the pixel snap option in godot in project> project settings> general> rendering> quality? Or enable linear filtering together with the pixel snap option enabled?
Edit: Reading more carefully, I think you refer to that option … The “sharp bilinear” can perhaps be implemented with a shader, I don’t know how to do it, but I’m interested. So I ask you another question: how do I get / create a texture that does not correspond to the pixels in godot?

estebanmolca | 2020-05-29 16:15