Skip to content

Commit ed3f072

Browse files
authored
Merge pull request #1418 from The-E/shader_normal_fix
Fix bug in normal map rendering
2 parents 98af9dd + c1b222f commit ed3f072

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/def_files/main-f.sdr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void main()
291291
// Normal map - convert from DXT5nm
292292
vec2 normalSample;
293293
normal.rg = normalSample = (texture(sNormalmap, texCoord).ag * 2.0) - 1.0;
294-
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
294+
normal.b = clamp(sqrt(1.0 - dot(normal.rg, normal.rg)), 0.0001, 1.0);
295295
normal = fragTangentMatrix * normal;
296296
float norm = length(normal);
297297
// prevent breaking of normal maps

0 commit comments

Comments
 (0)