Hi all,
I've been puzzling with my specular highlights, trying to add specular normalization.
Basically applying the theory from this article: https://seblagarde.wordpress.com/tag/specular/
float normFactor = (power + 2.0f) / ( 4.0f * PI * ( 2.0f - (2.0f * (-power / 2.0f) ) ) );
When I apply this in my shader like this, I get basically no more specular at all:
// specular Blinn-phong
float power = pLightSetup.mat.SpecPower;
float normFactor = (power + 2.0f) / ( 4.0f * PI * ( 2.0f - (2.0f * (-power / 2.0f) ) ) );
float tIntensity = pLightSetup.mat.SpecIntensity;
// Blinn-phong specular
float3 HalfWay = normalize(toEye + -dirLight.Direction);
NdotH = saturate(dot(HalfWay, pLightSetup.Normal));
specular = dirLight.ColorIntensity.rgb * pow(NdotH, power) * tIntensity;
specular *= normFactor;
Result:
And this is the result if I just comment out the *= normFactor:
I also played around increasing the specular intensity + using normalization, this is with intensity 40.0 and normalization:
Top row = specular power 16, left to right: intensity 0.1, 0.2, 0.4, 0.7, 1.0
Bottom row = intensity 1.0, left to right: power 10, 25, 50, 100, 300.
(in the last screenshot the intensities are multiplied by 40.0f).
Question:
The goal of the normalization is to make the sharper (higher power) highlights appear sharp/ strong, and the lower power highlights, be more 'vague'/ rough.
Any thoughts on what I might be doing wrong?
All input is appreciated.