I hope you are all doing ok. I have an issue with my Fresnel shader that doesn't allow the Fresnel to change as my camera moves around. I'm not sure what i'm doing wrong. I'm using glsl with the Schlick Fresnel algorithm along with a Diffuse BRDF. A picture says a thousand words, so let me show you the issue I am having. For debugging purposes, I am only rendering the Fresnel, nothing else.

The following image shows the Fresnel working perfectly from this particular angle (i'm looking along the direction the light is facing)

However, the following image shows the Fresnel not working when I pan the camera around the object to arrive at it's back (facing more or less against the light direction.)

As you can see, the Fresnel didn't change at all when i moved the camera, It's as if it's "Baked" into the object.

The code for the Schlick algorithm used in this application is:

vec3 Specular_Fresnel_Schlick( in vec3 SpecularColor, in vec3 PixelNormal, in vec3 LightDir )
{
float NdotL = max( 0, dot( PixelNormal, LightDir ) );
return SpecularColor + ( 1 - SpecularColor ) * pow( ( 1 - NdotL ), 5 );
}


All calculations are done in world space.

• I don't see you taking the camera position (or view direction for that matter) into account at all in your fresnel calculation Mar 17, 2016 at 8:30
• That is correct. This is because the algorithm doesn't say anything about camera position or view direction. Am I missing something in the algorithm? Mar 17, 2016 at 8:45
• Wikipedia as well as the original paper are somewhat confusingly written from modern CG perspective. What's meant there is the dot product between surface normal and the direction from surface point towards viewer. And that's not the whole specular term, just one of the factors to be multiplied together in certain lighting (reflectance) models. Mar 17, 2016 at 9:08
• Thanks @snake5. however. according to Wikipedia theta is the angle between the direction from which the incident light is coming and the normal of the interface between the two media, hence cos(theta)=(dot(N,V)) ^^Wikipedia contradicts it'self in that statement. First it says that theta is the angle between light and normal, then says theta is the angle between normal and view. Can you show me how the Schlick algorithm should be by modifying my Schlick function in the OP. Thanks. Mar 17, 2016 at 9:18
• Did you read the last paragraph as well? Also, this might help regarding the implementation: filmicgames.com/archives/557 Mar 17, 2016 at 9:43