I've come across something weird in HLSL. Well, maybe it's not that weird, but it was unexpected for me. There's probably a simple explanation. Anyway...
when I do this in my normal mapping shader:
float3 normal = normalize(2.0f*tex2D(TextureSamplerN, PSIn.TexCoords) - 1.0f);
...I get a different result to if I do this:
float3 normal = 2.0f*tex2D(TextureSamplerN, PSIn.TexCoords) - 1.0f; normal = normalize(normal);
It seems like the latter one produces the correct result when I run my program, but I have no idea why they're different. Any ideas?