1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Fix "Light Only" mode of CanvasItemMaterial

This commit is contained in:
Danil Alexeev
2023-03-21 12:18:15 +03:00
parent c64afeb017
commit 43b0702a02
4 changed files with 26 additions and 6 deletions

View File

@@ -568,7 +568,7 @@ void main() {
}
#ifdef MODE_LIGHT_ONLY
color = vec4(0.0);
float light_only_alpha = 0.0;
#elif !defined(MODE_UNSHADED)
color *= canvas_data.canvas_modulation;
#endif
@@ -611,6 +611,9 @@ void main() {
}
light_blend_compute(light_base, light_color, color.rgb);
#ifdef MODE_LIGHT_ONLY
light_only_alpha += light_color.a;
#endif
}
// Positional Lights
@@ -695,8 +698,15 @@ void main() {
}
light_blend_compute(light_base, light_color, color.rgb);
#ifdef MODE_LIGHT_ONLY
light_only_alpha += light_color.a;
#endif
}
#endif
#ifdef MODE_LIGHT_ONLY
color.a *= light_only_alpha;
#endif
frag_color = color;
}