From 9c7c1fa9b049fa54e39f2e23fbbd4bcee818552a Mon Sep 17 00:00:00 2001 From: Massimiliano Corsini maxcorsini Date: Thu, 26 Oct 2006 13:13:08 +0000 Subject: [PATCH] light colors fixed --- src/meshlab/shaders/Cook-Torrance.frag | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/meshlab/shaders/Cook-Torrance.frag b/src/meshlab/shaders/Cook-Torrance.frag index c3cce6af0..809af4530 100644 --- a/src/meshlab/shaders/Cook-Torrance.frag +++ b/src/meshlab/shaders/Cook-Torrance.frag @@ -17,6 +17,11 @@ uniform float ni; void main() { + // the material propertise are embedded in the shader (for now) + vec4 mat_ambient = {1.0, 1.0, 1.0, 1.0}; + vec4 mat_diffuse = {1.0, 1.0, 1.0, 1.0}; + vec4 mat_specular = {1.0, 1.0, 1.0, 1.0}; + // normalize interpolated normal vec3 N = normalize(normal); @@ -48,8 +53,11 @@ void main() float k = pow(1.0 - NdotV, 5.0); float F = 1.0 - k + ni * k; + // ambient + vec4 ambient = mat_ambient * gl_LightSource[0].ambient; + // diffuse color - vec4 kd = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; + vec4 kd = mat_diffuse * gl_LightSource[0].diffuse; - gl_FragColor = kd * (F * D * G) / NdotV; + gl_FragColor = ambient + kd * (F * D * G) / NdotV; }