Hello,
I am computing the dot product of two normalized vectors in HLSL, as far as I know, that should only return a float value in the range of [-1,1]. However, it's giving me a float value outside of that range, for some reason that I'm asking your help for finding out...
Code:
float3 normal = normalize(float3(input.normal.x,input.normal.y,input.normal.z));
float3 light = normalize(float3(0.25f, 0.5f, -1.0f));
float m = abs(dot(normal, light));
if( m > 2.0f )
return float4(1,0,0,1);
This is in the pixel shader, I tested whether the dot value really gives back a float value above 1 by rendering a red pixel if it does... and it does.
Please help me find out what I am missing here...
I'm thinking it's somewhere in the value of input.normal... but then I'm wondering what it could be because I'm normalizing that vector anyway. It should give a unit vector regardless of weird values in input.normal
Thank you,