Trouble calculating 'flat' normal

Hi,

I use

vec3 flatNormal = normalize(cross(dFdx(eyeVec.xyz), dFdy(eyeVec.xyz)));

to calculate a ‘flat’ normal based on the triangle only in the fragment shader. Eyevec is calculated with

eyeVec = gl_ModelViewMatrix * adjustedVec;

where adjustedVec is basically the gl_Vertex, but with an slightly altered z-coordinate.

Now on my own PC it works fine, but on my dad’s pc (older one) it seems like the flatNormal is the opposite of the normal I get on my own PC (which gives the correct results). I’m not 100% sure it’s the exact opposite, but it does seem that if I invert it I get the right results.

any idea what causes this? Is there some way to alter this code to make it more robust?

Thank you!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.