My problem is the implementation, i tried to implement it, but it looked really bad. The specular lobe was more of a halo around the sphere(yes, i was rendering a white metallic sphere) more than a lobe, like in the implementation pictures in the book.
Here is the shading equation:
Here is a picture of my sphere:
I am using a value of zero for the diffuse color because, in reality, metals don't show local subsurface scattering with means that the only needed reflection term is the specular which i assigned a value of 1.0f to.
Even after i added diffuse AND ambient lighting, that specular halo is still there.
Here is my implementation( just the pixel shader):
float3 FinalColor = 0;
for(int i = 0; i < MAX_LIGHT; i++)
{
float3 ViewVecW = normalize(gEyePosW - PosW);
float3 LightVecW = normalize(gLightPosW.xyz - PosW);
float3 Falloff = distance(gLightPosW.xyz, PosW);
float3 HalfVecW = normalize(ViewVecW + LightVecW);
float cosTi = saturate( dot(NormW, LightVecW));
float cosTh = saturate( dot(NormW, HalfVecW));
float4 BRDF = Kd + Ks*pow(cosTh,m);
FinalColor += BRDF * gLightDiff*cosTi;
}
FinalColor *= tex2D(Mesh_sTex, TexC);
return float4(FinalColor,1.0f);
kd = cDiff/Pi
Ks = (m+8)/(8*Pi)*cSpec