Skip to main content
gamedev.net
🔒 Locked

Reverse Lighting

Started by questors_endgame 2 replies 400+ views
Original Post
questors_endgame
questors_endgame
What causes lighting to light the wrong side of a mesh, so the back of a cube is lit when light shines on the front. I can't flip the normals because the faces will not be visible from the correct side then. This is with opengl, I don't know many more details, it's just drawing triangles from indices. This seems partly related to flipping the mesh horizontally, if that is happening how would one flip it but not get messed up normals or lighting?
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com
Zakwayda
Zakwayda
If the normals are pointing the 'wrong way', then flip them. If that results in the wrong side of the faces being visible, then reverse the winding of the faces, or change OpenGL's cull mode or winding order.

[Edit: My wording was poor (see Kalidor's post below). What I meant was that if the initial flipping of the mesh results in incorrect face culling, you can correct this by changing the winding order or cull mode.]

[Edited by - jyk on October 12, 2006 12:17:23 PM]
Kalidor
Kalidor
Normals have no effect on face culling. They are just like any other per-vertex data. Since they are per-vertex, that means a face doesn't have a single corresponding normal.

Imagine you have a screen-aligned quad and the top two vertices have normals which point out of the screen and the bottom two vertices' normals point into the screen. If normals affected face culling, would the quad be visible or invisible? Would half of it be visible?
questors_endgame
questors_endgame
I don't understand about normals having no effect. Winding of the faces sounds like it may be the issue, can someone explain how to do this and why winding order matters?
___ _ _ _Journal with textures, moddeling:http://btoxin.livejournal.comGame Website:http://fadedearth.infinityanalog.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.