diff options
Diffstat (limited to 'resources/shaders/gouraud.vs')
-rw-r--r-- | resources/shaders/gouraud.vs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/resources/shaders/gouraud.vs b/resources/shaders/gouraud.vs index a9f3f6118..17cc764e2 100644 --- a/resources/shaders/gouraud.vs +++ b/resources/shaders/gouraud.vs @@ -65,11 +65,15 @@ void main() intensity.y = 0.0; if (NdotL > 0.0) - intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(normal, reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + { + vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; + intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); + } // Perform the same lighting calculation for the 2nd light source (no specular applied). NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); - intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; + if (NdotL > 0.0) + intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // compute deltas for out of print volume detection (world coordinates) if (print_box.actived) |