Moon Phase
Show a pseudo-moon and progress it through its phases. You need to use material.set_shader_parameter("cval", cval)
in your Godot code with something like process’s delta.
Shader code
shader_type canvas_item;
uniform float cval = 0.0;
uniform vec4 shade = vec4(0, 0, 0, 255);
uniform float shade_radius = 0.5;
void fragment() {
vec2 center = vec2(cval, 0.5);
COLOR.a = 0.0;
float dist = distance(UV, vec2(0.5, 0.5));
if(dist < shade_radius) {
COLOR = vec4(255, 255, 255, 255);
}
dist = distance(UV, center);
if(dist < shade_radius) {
COLOR = shade * COLOR.a;
}
}
Yessss, finally. Thank you so much