PDA

View Full Version : Normal Independent Lightning



05-01-2006, 05:23 AM
Hello,

I'm using OpenGL for a viewer of models where the triangles have normals in arbitrary directions. Sometimes the normal points inside and sometimes outside.

This makes my models look like a chequered surface and the hidden surface removal does not match with the lightning.

Is there a setting where OpenGL can light the models correctly independent of the normal direction?

If not, is there a function which automatically aligns all normals?

Thanks
/Jonas Forssell, Gothenburg, Sweden

jide
05-01-2006, 05:40 AM
What do you exactly mean ? Does your normals that point inside the model should point outside ? Is that what you mean ?

zeoverlord
05-01-2006, 06:12 AM
well it's sort of possible, you can read the gl_FrontFacing variable in the fragmentshader and then if it's back facing you can reverse the normal.

But it is much better to get the model normals correct before viewing them.