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

Merge pull request #44293 from lawnjelly/normal_compression

Fix bug in normal map decompression
This commit is contained in:
Rémi Verschelde
2020-12-11 13:38:00 +01:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -455,7 +455,7 @@ void main() {
if (use_default_normal) { if (use_default_normal) {
normal.xy = texture2D(normal_texture, uv).xy * 2.0 - 1.0; normal.xy = texture2D(normal_texture, uv).xy * 2.0 - 1.0;
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; normal_used = true;
} else { } else {
normal = vec3(0.0, 0.0, 1.0); normal = vec3(0.0, 0.0, 1.0);

View File

@@ -549,7 +549,7 @@ void main() {
if (use_default_normal) { if (use_default_normal) {
normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0; normal.xy = textureLod(normal_texture, uv, 0.0).xy * 2.0 - 1.0;
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; normal_used = true;
} else { } else {
normal = vec3(0.0, 0.0, 1.0); normal = vec3(0.0, 0.0, 1.0);