Hey guys, I'm having a small problem with my normal mapping.
Here's how it looks:
Now when I comment out this line here (computing of the z component instead of reading it from the file):
// Sample the normal map, and convert the normal to world space
normalTS.xyz = NormalMap.Sample(AnisotropicSampler, input.UV).xyz * 2.0f - 1.0f;
//normalTS.z = sqrt(1.0f - ((normalTS.x * normalTS.x) + (normalTS.x * normalTS.y)));
normalWS = mul(normalTS, tangentToWorld);
normalWS = normalWS * rsqrt(dot(normalWS, normalWS));
It seems to look fine:
Why is that ? Does the z reconstruction only work for 3Dc compressed normal maps ? But shouldn't this algorithm work for anything ?
Well looking at it in PIX it seems to generate NaN.