Godot Version
4.7.2
Question
Hello. I am making a pixel art game and I wanted to use the SDF functions in a canvas shader for my water tilemap. This code works great.
float distance = texture_sdf(screen_uv_to_sdf(SCREEN_UV));
// set the color based on the distance
Except it is not snapped to my pixel grid. if I try
vec2 snapped_screen_uv = floor(SCREEN_UV * screen_pixel_resolution) / screen_pixel_resolution;
then because I am snapping the screen uv instead of the local uv and because I am using smooth sub pixel camera movement, it jitters anytime I move my camera. I thought for sure there would be a relatively easy to get correctly snapped screen uv coordinates, but after hours of troubleshooting and googling, I am at a loss. I thought maybe you can snap the local or world coordinates then transform them into screen space but I couldn’t figure it out. I would love some help.