Changing the value of TEXTURE

Godot Version

4.2.1

Question

I’m working on a game that uses Pixel Art, and I’ve been using a shader to help keep the art crisp (GodotThings/SmoothPixelFiltering at master · CptPotato/GodotThings · GitHub). The problem is, I also want to use shaders to edit the general palette of sprites. These shaders conflict and I lose the aesthetic.

image
Example: If I try to change some of the colors to white, using my own shader code, subpixels and other messy stuff appears. Note that the non-white parts look a lot nicer.

Based on the code for the SmoothPixelFiltering shader, if I could somehow change the pixel color that’s in TEXTURE (or some copied variable), I could pass the modified sampler2D into the shader and keep my nice clean pixels. I couldn’t find any docs online on whether this is possible.

Thank you!

you can set the filter to nearest on any 2d_node, aswell as inside of shaders which makes them clean. If thats what you meant

I chose to use a shader based on this video: https://www.youtube.com/watch?v=wtV-4pQ_n70
The Nearest filter can often lead to inconsistent pixel sizes, and stuttering, which I wanted to avoid