This is a really basic shader I'm studying so I know how this works. I understand most of it, I recognize the patterns but what I don't understand is what exactly gets passed to the final outcome of fragment()
shader_type canvas_item;
uniform float bendy: hint_range(0.1,10.0);
float plot(vec2 st, float pct) {
return smoothstep( pct-0.02, pct, st.y) -
smoothstep(pct, pct+0.02, st.y);
}
void fragment() {
float y = pow(abs(UV.x), bendy);
vec3 color = vec3(y);
float pct = plot(UV, y);
color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0);
COLOR = vec4(color, 1.0);
}
This line:
color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0);
is where I get tripped. What is going on in this equation?
Below is what the shaders show. They draw a line and uniform float bendy
bends them, I think, according to the value of y
in the plot()
function.
Number values denote the value of bendy
.