from the docs:
If you want the lights to add together, add the light contribution to DIFFUSE_LIGHT using +=, rather than overwriting it.
their example:
void light() {
DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * ALBEDO;
}
heres a basic example of what you want:
uniform vec4 COLOR_A : hint_color;
uniform vec4 COLOR_B : hint_color;
uniform float THRESHOLD: hint_range(-1,1) = 0.;
void light() {
// you can add more colors, or perhaps a texture
vec3 f = mix(COLOR_A,COLOR_B, step(THRESHOLD, dot(NORMAL, LIGHT)));
// normalize the lighting, by dividing by the number of effective lights, or some other function
f /= 5.;
DIFFUSE_LIGHT += f.;
}
theres no light position tho, LIGHT
is the light direction in camera space
, you can pass the light position as a uniform vec3
shader support in godot is very inferior compared to other engines like unity, for now
hopefully godot 4.0 will change this (cant wait for compute shaders :D)