Quick answer: Implement void light() in the canvas shader. Multiply COLOR with LIGHT_COLOR and add to LIGHT output.
Custom canvas shader for water. Place a PointLight2D nearby. No effect. Default fragment doesn’t loop through lights.
The Fix
shader_type canvas_item;
void fragment() {
COLOR = texture(TEXTURE, UV);
}
void light() {
LIGHT = COLOR.rgb * LIGHT_COLOR.rgb * LIGHT_COLOR.a * LIGHT_ENERGY;
}
The light() function runs per-light. LIGHT_COLOR includes light's energy and color; LIGHT_ENERGY broadcasts the source's intensity.
Verifying
Add PointLight2D in scene. Sprite brightens within radius. Without light(): unaffected.
“Implement light(). Lights affect.”
Related Issues
For shader UV flip, see UV flip. For SCREEN_TEXTURE, see SCREEN_TEXTURE.
light() function. Lights apply.