Name: Anonymous 2008-11-12 17:52
Hey guys
I'm writing some shaders (HLSL), and to do per-pixel lighting I need to calculate the cosine of the angle between the surface normal and the light direction. I would have to normalize the interpolated normal for every pixel, and calculating the lenght of a vector for every pixel is going to be quite expensive.
So there's my question, is there a way to lerp the dot product/the normal vectors so that the result will be accurate?
I'm writing some shaders (HLSL), and to do per-pixel lighting I need to calculate the cosine of the angle between the surface normal and the light direction. I would have to normalize the interpolated normal for every pixel, and calculating the lenght of a vector for every pixel is going to be quite expensive.
So there's my question, is there a way to lerp the dot product/the normal vectors so that the result will be accurate?