Modulate Before Light

Before Light Modulate – Alters the color of the object before the light pass, preserving luminosity. The standard Modulate setting will change the color of the object and the light after the light has been applied.


cybereality on Reddit – Provided the super helpful solution for Before Light Modulate.

Shader code
shader_type canvas_item;

uniform vec4 before_light_modulate : hint_color = vec4(1.0,1.0,1.0,1.0);

void fragment() {
	vec4 texture_color = texture(TEXTURE, UV);
		COLOR = texture_color;
	} else {
		COLOR = texture_color * before_light_modulate;
2d, Color, light, modulate
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from MightyMochiGames

2D Cel / Toon Shader v2 (Basic)

Toon Shading for 2D Sprites v1

2D Cel / Toon Shader v2 +Plus

Related shaders

UCBC’s Stylized Light with Light Masking

2D Light Z-Depth

2D Rim Light

Notify of

Inline Feedbacks
View all comments