2d nearest-neighbor scaling

Godot Version

4.6.2

Any chance to able to use this on 2D ?

So far when using 2d on far away backgrounds, once the image scale gets smaller, its like the resolution increases;

Making everything work in reverse, far away images look more defined, and image closer to the camera look more blured and low res.

1 Like

@Calinou would be the person to ask about that, as they made the change.

When using the viewport stretch mode, scaling the viewport to the window size already uses nearest-neighbor filtering.

When using the canvas_items stretch mode, the rendering resolution increases to match the window size. If you want to pixelate certain sprites in this case, you can find and apply a pixelation shader to it. It’s slower than relying on the viewport stretch mode, but gives you more control over what to pixelate.

1 Like

i cant understand, what you ve explained… ( Bro stop using cult language !!! )

the only way i could make it work was to:

  • use a tileMap layer, lower the scale to 0.3, 0.3

  • put everything inside a subviewport container / subviewport

  • make the subviewport “size” the same size has the tileMap area in the level

  • go to subviewPort container and set the scale to 2.65, 2.65

  • the image resolution is much lower

  • the “subviewPort container” is inside a parallax2D “Scroll scale“ 0.9, subViewport “Update Mode“ set to “disable“

witch “viewport “ do you mean ? the one in project settings / rendering / viewPort… I dont know how many viewPorts godot has ?

pixellated shaders dont work on tileMaps, it works for a Sprite2D, but in tilemapslayers… i think the sahder applies per tile… so great…, viewport in everything, it doesnt work, like the normal photoshop Nearest Neighbor… someone invented a new meaning for the word Nearest Neighbor now seems i dont know what it means anymore…

You want to make a 2d image, tilemap, in lower resolution you end up spending 3 or 4 times more GPU…