Skip to content

Commit 9b5e7ce

Browse files
committed
Clamp the dot product of eye direction and surface normal to prevent intense glare when rendering a model in a render target with no lighting.
1 parent e39a8bb commit 9b5e7ce

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
@@ -365,7 +365,7 @@ void main()
365365
baseColor.rgb = CalculateLighting(normal, baseColor.rgb, specColor.rgb, glossData, fresnelFactor, shadow, aoFactors.x);
366366
#else
367367
#ifdef FLAG_SPEC_MAP
368-
baseColor.rgb += pow(1.0 - dot(eyeDir, normal), 5.0 * clamp(glossData, 0.01, 1.0)) * specColor.rgb;
368+
baseColor.rgb += pow(1.0 - clamp(dot(eyeDir, normal), 0.0, 1.0), 5.0 * clamp(glossData, 0.01, 1.0)) * specColor.rgb;
369369
#endif
370370
#endif
371371
#ifdef FLAG_ENV_MAP

0 commit comments

Comments
 (0)