I am trying to implement the Cook-Torrance model, and this is how I calculate the parameter Rs:
float Rs(float m,float F,vec3 N, vec3 L,vec3 V, vec3 H)
{
float result;
float NdotV= dot(N,V);
float NdotH= dot(N,H);
float NdotL= dot(N,L);
float VdotH= dot(V,H);
float Geom= min(min(1.0, (2.0*NdotV*NdotH)/VdotH), (2.0*NdotL*NdotH)/VdotH);
float Rough= pow(1.0/(pow(m,2.0)*pow(NdotH,4.0)), ( pow(NdotH,2.0)-1.0)/( pow(m,2.0)*pow(NdotH,2.0)));
float Fresnel= F + pow(1.0-VdotH,5.0) * (1.0-F);
return (Fresnel * Rough * Geom)/(NdotV*NdotL);
}
I apply this formula:

Where I set m to 0.5 and F0 to 2.0.
But I think it's wrong because I'm getting a black area where there should be the specular light:

PS: With OpenGL 2.1, GLSL 1.20.
