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

More from MightyMochiGames

2D Rim Light

Toon Shading for 2D Sprites v1

2D Cel / Toon Shader v2 (Basic)

Related shaders

2D Light Z-Depth

2D Rim Light

2D Rim Light

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.
Inline Feedbacks
View all comments