diff --git a/src/meshlab/shaders/Cook-Torrance.frag b/src/meshlab/shaders/Cook-Torrance.frag
new file mode 100644
index 000000000..5d7b89efc
--- /dev/null
+++ b/src/meshlab/shaders/Cook-Torrance.frag
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_FragColor = gl_Color;
+}
diff --git a/src/meshlab/shaders/Cook-Torrance.gdp b/src/meshlab/shaders/Cook-Torrance.gdp
new file mode 100644
index 000000000..8e8fb0cef
--- /dev/null
+++ b/src/meshlab/shaders/Cook-Torrance.gdp
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/meshlab/shaders/Cook-Torrance.vert b/src/meshlab/shaders/Cook-Torrance.vert
new file mode 100644
index 000000000..5ee5de45c
--- /dev/null
+++ b/src/meshlab/shaders/Cook-Torrance.vert
@@ -0,0 +1,35 @@
+void main()
+{
+ vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 LightVector = vec3(gl_LightSource[0].position);
+ vec3 VertexToEye = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
+ vec3 HalfVector = vec3(gl_LightSource[0].halfVector);
+ float NdotH = max(0.0, dot(normal, HalfVector));
+
+ vec3 RoughnessParams = vec3(0.5, 0.5, 0.5);
+
+ //Start the "D" term, use Blinn Gaussian
+ float Alpha = acos(NdotH);
+ float C = RoughnessParams.x;
+ float m = RoughnessParams.y;
+ float D = C * exp(-(pow(Alpha / m, 2.0)));
+
+ //Start the "G" term
+ float NdotV = dot(normal, VertexToEye);
+ float VdotH = dot(HalfVector, VertexToEye);
+ float NdotL = dot(LightVector, normal);
+ float G1 = 2.0 * NdotH * NdotV / NdotH;
+ float G2 = 2.0 * NdotH * NdotL / NdotH;
+ float G = min(1.0, max(0.0, min(G1, G2)));
+
+ //Start the fresnel term. Use the approximation from
+ //http://developer.nvidia.com/docs/IO/3035/ATT/FresnelReflection.pdf
+ float R0 = RoughnessParams.z;
+ float F = R0 + (1.0 - R0) * pow(1.0 - NdotL, 5.0);
+
+ vec4 DiffuseColor = gl_FrontMaterial.diffuse;
+
+ gl_FrontColor = DiffuseColor * F * D * G / (NdotL * NdotV);
+ gl_Position = ftransform();
+
+}
diff --git a/src/meshlab/shaders/Oren-Nayar.frag b/src/meshlab/shaders/Oren-Nayar.frag
new file mode 100644
index 000000000..5d7b89efc
--- /dev/null
+++ b/src/meshlab/shaders/Oren-Nayar.frag
@@ -0,0 +1,4 @@
+void main()
+{
+ gl_FragColor = gl_Color;
+}
diff --git a/src/meshlab/shaders/Oren-Nayar.gdp b/src/meshlab/shaders/Oren-Nayar.gdp
new file mode 100644
index 000000000..12aea194c
--- /dev/null
+++ b/src/meshlab/shaders/Oren-Nayar.gdp
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/meshlab/shaders/Oren-Nayar.vert b/src/meshlab/shaders/Oren-Nayar.vert
new file mode 100644
index 000000000..bbda4a0e6
--- /dev/null
+++ b/src/meshlab/shaders/Oren-Nayar.vert
@@ -0,0 +1,31 @@
+void main()
+{
+ vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
+ vec3 LightVector = vec3(gl_LightSource[0].position);
+
+
+ vec3 VertexToEye = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
+
+ float VdotN = dot(VertexToEye, normal);
+ float LdotN = dot(LightVector, normal);
+ float Irradiance = max(0.0, LdotN);
+
+ float AngleViewNormal = acos(VdotN);
+ float AngleLightNormal = acos(LdotN);
+
+ float AngleDifference = max (0.0, dot(normalize(VertexToEye - normal * VdotN),
+ normalize(LightVector - normal * LdotN)));
+
+ float Alpha = max(AngleViewNormal, AngleLightNormal);
+ float Beta = min(AngleViewNormal, AngleLightNormal);
+
+ vec4 DiffuseColor = gl_FrontMaterial.diffuse;
+
+ float RoughnessSquared = 0.5;
+ float A = 1.0 - (0.5 * RoughnessSquared) / (RoughnessSquared + 0.33);
+ float B = (0.45 * RoughnessSquared) / (RoughnessSquared + 0.09);
+
+ gl_FrontColor = DiffuseColor * (A + B * AngleDifference * sin(Alpha) * tan(Beta)) * Irradiance;
+
+ gl_Position = ftransform();
+}
diff --git a/src/meshlab/shaders/phong.vert b/src/meshlab/shaders/phong.vert
index fe16e0bb0..89d634bff 100644
--- a/src/meshlab/shaders/phong.vert
+++ b/src/meshlab/shaders/phong.vert
@@ -1,10 +1,12 @@
void main()
{
+
vec3 normal, lightDir, viewVector, rVector;
vec4 diffuse, ambient, globalAmbient, specular = vec4(0.0);
normal = normalize(gl_NormalMatrix * gl_Normal);
lightDir = normalize(vec3(gl_LightSource[0].position));
+ viewVector = normalize(vec3(2.0 * gl_LightSource[0].halfVector - gl_LightSource[0].position));
diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
globalAmbient = gl_LightModel.ambient * gl_FrontMaterial.ambient;
@@ -15,4 +17,4 @@ void main()
gl_FrontColor = globalAmbient + dot(normal, lightDir) * diffuse + ambient + specular;
gl_Position = ftransform();
-}
+}