- Edited
I'm new to shaders and currently following along in Godot with The Book of Shaders.
I noticed that when I color the albedo with:
void fragment() {
vec2 st = FRAGCOORD.xy / VIEWPORT_SIZE;
ALBEDO = vec3(st.r, st.g, 0.0);
}
The color of my PlaneMesh changes as I zoom in and out of the editor. I assume this is because FRAGCOORD is in terms of screen space so as I zoom in the amount of space it takes up is closer to the 0 and 1 of my normalized coordinates?
The following image is what I see zoomed out when using the above snippet.
The following image is what I see zoomed in when using the above snippet.
The following image is what I see when I switch to using UV instead.
If I want to essentially, have it span the entire [0,1) coordinate range do I just use UV? Is there any time when that wouldn't be a good idea?
Is SCREEN_UV the same as FRAGCOORD.xy / VIEWPORT_SIZE
?
Sorry if I'm using the wrong technical terms as well.