View Full Version : Normals pointing inward
02-28-2005, 04:10 PM
Please excuse my ignorance. I am reading OFF files and computing normals for lighting and some of the models come out fine and some of the models appear to be lit on the inside which i think means that the normals are pointed inward. So how do i differentiate the models that have the normals pointing inward and the ones that will display fine.
02-28-2005, 11:44 PM
It is not that easy to detect, but if all normals points in the wrong direction you might simply flip all normals when you load the model, but as I said it is not easy to make this automatic because what is the inside and the outside of your model.
It is possible to detect it, at least if the model is closed, but it takes some coding to do it.
You might consider using doublesided lighting to improve things a bit.
03-02-2005, 06:30 AM
Something I do at work is calculate the centroid of the object after it has loaded. I then calculate the angle between the vector formed from the centroid to a random indice of a few different faces to the normal vector of each of those faces. If I notice there is a lack of large angles formed I just flip all the normals.
I also add a button to all 3D loaders I write to do the flipping. Given that I can renormal an object with 150k+ vertices and 300k+ faces in under a second that cost of adding this function is cheap.
03-02-2005, 07:36 AM
I think you can also just reverse the winding.
glFrontFace(GL_CCW or GL_CW).
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.