1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Clamp normal when calculating 2D lighting to avoid artifacts

This commit is contained in:
clayjohn
2023-04-18 17:26:17 -07:00
parent a7276f1ce0
commit ab603e347f
2 changed files with 2 additions and 2 deletions

View File

@@ -508,7 +508,7 @@ void main() {
if (bool(draw_data.flags & FLAGS_FLIP_V)) {
normal.y = -normal.y;
}
normal.z = sqrt(1.0 - dot(normal.xy, normal.xy));
normal.z = sqrt(max(0.0, 1.0 - dot(normal.xy, normal.xy)));
normal_used = true;
} else {
normal = vec3(0.0, 0.0, 1.0);