Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: glScale and normals

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    glScale and normals

    Hi all,

    I have a question concerning the normals of an object.

    In a modeller app, I generate the wireframe of an object, including normals at creation time of an object.
    I then allow the user to manipulate the transformations of the object. When a non-uniform scaling is used the normals are incorrect. Since I have stored the normals in a data structure when the object was created, I'd prefer not to have to regenerate them. Can I do a transformation on the calculated normals before passing them to OpenGL to correct for this?

    - Lutz

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Reading, Berkshire, England
    Posts
    17

    Re: glScale and normals

    whenever you do non-uniform scaling just enable GL_NORMALIZE - this sorts it all out for you.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    Re: glScale and normals

    Ahhh, thanks. At first I thought this is a global flag, but I see that I can enable it on a per-object basis, so I can check for scaling and then enable it if present.

    Thanks for the hint.

    - Lutz

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,982

    Re: glScale and normals

    When you do non-uniform scaling, your normals will be incorrect (point in the wrong direction) even if you normalize them. This will mess up lightning. There is no function to make the normals correct, other than to recalculate them.

    Just a note.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    Re: glScale and normals

    Hmmm. It looked pretty good

    I was wondering whether I could maybe use an inverse scale transformations for the pre-calculated normals before sending them to glNormal3(). Then OpenGL will transform them to the correct orientation when it uses them.

    While the lighting is not crucial (it's a preview only), I would like to get it right.
    But recalculating the pre-calculated normals is not something I want to do at this point.

    - Lutz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •