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

Merge pull request #75181 from dalexeev/fix-light-only-mode

Fix "Light Only" mode of `CanvasItemMaterial`
This commit is contained in:
Yuri Sizov
2023-05-27 17:28:29 +02:00
committed by GitHub
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;
}