Results 1 to 4 of 4

Thread: Normals pointing inward

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2005

    Normals pointing inward

    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.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001

    Re: Normals pointing inward

    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.


  3. #3
    Junior Member Newbie
    Join Date
    Mar 2005
    Somewhere left of center

    Re: Normals pointing inward

    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.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Feb 2004
    Long Island, New York

    Re: Normals pointing inward

    I think you can also just reverse the winding.
    glFrontFace(GL_CCW or GL_CW).

Similar Threads

  1. How to calcualte what viewport is pointing towards
    By q13918 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-04-2017, 07:34 AM
  2. Directional Light - Always pointing up?
    By shwhjw in forum OpenGL: GLSL
    Replies: 3
    Last Post: 08-05-2011, 11:54 PM
  3. Inward-pointing normal?
    By kingcu in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-15-2005, 04:45 AM
  4. pointing the sprite at the cursor coords
    By Surgeon in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-25-2004, 11:01 AM
  5. Pointing your model in the correct direction?
    By Elixer in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 01-23-2001, 10:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean