camera/normal dot product and projection
For each triangle in my mesh i do the dot product of -normal of the triangle and camera vector(in the shader).
I do this because when the result of the dot product inform me of the front/back face related to the camera.
If the result of the dot product for example is 0 mean that the normal is perpendicular of my camera vector, then i must change to drawing from front face(for example red)and start to drawing back face(for example yellow if the two face colors are red and yellow).
My problem is this:
when the faces or triangles are far away all work fine, but when the faces are near the camera the change of back/front face is incorrect, i think that this may be relative to the projection matrix, but if this is true , how i can correct?
I can multiply the camera vector for the projection matrix?
Re: camera/normal dot product and projection
Have you considered just using gl_FrontFacing? It uses the winding order to determine just that and is accessible in your fragment program automagically.
If you want to do it your way, my only advice is to make sure your vectors are in the same space. For example, you camera look_dir is probably in world space so don't go dotting it against a normal in object or camera space.