What I tried to do was to implement this through GLSL since I already had a working implementation of Blinn-Phong reflection model with Phong shading. Basically I wanted the specular effect to be dependent on this by multiplying it with the Fresnel term. What I did was to compute an approximation of the Fresnel term, widely known as Schlick approximation and then just use it in the final result. However that just gave me a mesh with no specular highlights instead. It was as if I was just performing diffuse and ambient reflection. I'm sure there is something I've understood completely wrong about this but I'm pretty much confused about it at the moment. I'll post the shaders:

**Vertex shader**

#version 330 layout(location = 0) in vec4 position; layout(location = 1) in vec3 normal; uniform mat4 modelToWorldMatrix; uniform mat4 worldToViewMatrix; uniform mat4 viewToClipMatrix; uniform mat3 normalMatrix; //3x3 submatrix of the modelview matrix. No non-uniform scaling is used. uniform vec4 worldLight; smooth out vec3 eyeNormal; smooth out vec3 lightDirection; smooth out vec3 viewDirection; void main() { vec4 viewPos = worldToViewMatrix*modelToWorldMatrix*position; //Vertex in eye space gl_Position = viewToClipMatrix*viewPos; //Vertex shader has to generate vertex in clip-space eyeNormal = normalize(normalMatrix*normal); //Transform normal to eye space vec4 eyeWorldLight = worldToViewMatrix*worldLight; //Transform light position to eye space lightDirection = normalize(eyeWorldLight.xyz-vec3(viewPos)); //Compute direction to light viewDirection = normalize(-viewPos.xyz); //Compute direction to viewer }

**Fragment shader**

#version 330 //Make a simplification here, assuming the light intensity is already //combined together with the material properties of the object uniform vec3 ambientConstant; uniform vec3 diffuseConstant; uniform vec3 specularConstant; uniform float fZero; //Fresnel term at normal incidence smooth in vec3 eyeNormal; smooth in vec3 lightDirection; smooth in vec3 viewDirection; out vec4 outputColor; void main() { //Interpolated normal, light direction and view direction vec3 f_eyeNormal = normalize(eyeNormal); vec3 f_lightDirection = normalize(lightDirection); vec3 f_viewDirection = normalize(viewDirection); vec3 halfWay = normalize(f_lightDirection+f_viewDirection); //Halfway vector //Fresnel approximation float base = 1-dot(f_viewDirection, halfWay); float exp = pow(base, 5); float fresnel = exp+fZero*(1.0-exp); //Blinn-phong reflection model vec3 ambientReflection = ambientConstant; vec3 diffuseReflection = diffuseConstant*clamp(dot(f_lightDirection, f_eyeNormal), 0, 1); vec3 specularReflection = specularConstant*max(0.0,pow(dot(f_eyeNormal, halfWay), 80)); //Final color of the fragment outputColor.rgb = ambientReflection + diffuseReflection + fresnel*specularReflection; outputColor.a = 1.0; }

fZero is calculated in the application as following:

GLfloat fZero = pow((1.0f-(1.0f/1.31f)), 2)/pow((1.0f+(1.0f/1.31f)), 2);