Hi all,
I am playing around with a simple phong shader and found that the results for a specular exponent (shininess) of zero look very ugly.
This is my code for the specular term:
Code :vec4 Ispec = gl_FrontLightProduct[0].specular *pow(max(dot(R,E),0.0),gl_FrontMaterial.shininess);
Obviously the problem is that pow(0.0, 0.0) is undefined. Now I can workaround this by using max(dot(R,E),epsilon) with a very small non zero epsilon value or use an IF statement. As conditional branching is expensive I like to use the epsilon idea, which looks ok to me. But I am not sure if there are any issues with this approach, meaning that it fails in some cases I did not think of.
Thanks in advance for any input.




