#How to get shader to square aspect ratio?
6 messages · Page 1 of 1 (latest)
Are there supposed to be 4 quadrants, or is it all supposed to be one smooth rectangle?
you'll want to use normalised coordinates here rather than UV coordinates
uniform float scale = 1.0;
void fragment() {
vec2 res = 1.0 / SCREEN_PIXEL_SIZE;
vec2 st = FRAGCOORD.xy / res.xy;
st.x *= res.x / res.y;
COLOR.rg = mod(st.xy, scale);
}
I found a issue. It's because I'm using ColorRect and that doesn't give the size to shader.
That's a cool trick. Thanks, @plain walrus!
I switched to using SCREEN_PIXEL_SIZE and SCREEN_UV, but I like the result with your solution better.
I'm reworking my SpritePalettizer app in Godot4 and I wanted moving checkerboard background