opengl.shaders.lighting: Work around problem with specular highlighting.

This commit is contained in:
Rod Kay
2024-02-25 18:35:44 +11:00
parent 6e2edae1fb
commit d328369d24

View File

@@ -67,14 +67,15 @@ apply_Light (light Light,
float diffuse_Coefficient = max (0.0, float diffuse_Coefficient = max (0.0,
dot (Normal, dot (Normal,
Surface_to_Light)); Surface_to_Light));
vec3 Diffuse = diffuse_Coefficient * lit_surface_Color; vec3 Diffuse = diffuse_Coefficient * lit_surface_Color;
float specular_Coefficient = 0.0; float specular_Coefficient = 0.0;
if (diffuse_Coefficient > 0.0) if (diffuse_Coefficient > 0.0)
{ {
specular_Coefficient = pow (max (0.0, specular_Coefficient = pow (max (0.01, // Using '0.0' produces wierd results when
dot (Surface_to_Camera, dot (Surface_to_Camera, // light shines directly on a flat surface.
reflect (-Surface_to_Light, reflect (-Surface_to_Light,
Normal))), Normal))),
frag_Shine); frag_Shine);