aboutsummaryrefslogtreecommitdiff
path: root/client/shaders/object_shader/opengl_vertex.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'client/shaders/object_shader/opengl_vertex.glsl')
-rw-r--r--client/shaders/object_shader/opengl_vertex.glsl7
1 files changed, 6 insertions, 1 deletions
diff --git a/client/shaders/object_shader/opengl_vertex.glsl b/client/shaders/object_shader/opengl_vertex.glsl
index 488089392..59171145f 100644
--- a/client/shaders/object_shader/opengl_vertex.glsl
+++ b/client/shaders/object_shader/opengl_vertex.glsl
@@ -38,7 +38,12 @@ void main(void)
lightVec = sunPosition - worldPosition;
eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz;
- vIDiff = directional_ambient(normalize(gl_Normal));
+
+ // This is intentional comparison with zero without any margin.
+ // If normal is not equal to zero exactly, then we assume it's a valid, just not normalized vector
+ vIDiff = length(gl_Normal) == 0.0
+ ? 1.0
+ : directional_ambient(normalize(gl_Normal));
gl_FrontColor = gl_BackColor = gl_Color;
}