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 4 of 4

Thread: Normals matrix

  1. #1
    Intern Newbie
    Join Date
    Mar 2002
    Location
    Italy
    Posts
    44

    Normals matrix

    According to all the sources I searched on the internet and on books, when transforming an object with a matrix, to correctly transform the normals you have to multiply them by the matrix t(inv(M)), where t() is the transpose, inv() is the inverse and M is the matrix with the translation part removed.
    After this step you have to normalize the normals again.
    Is there a way to skip the normalization part, for example doing some assumptions on the initial matrix?
    Please, help me if you can.
    Thanks

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: Normals matrix

    Originally posted by Pody:
    when transforming ... normals ... Is there a way to skip the normalization part
    If your ModelView matrix contains no shears or scales, your normals should stay normalized.

  3. #3
    Intern Newbie
    Join Date
    Mar 2002
    Location
    Italy
    Posts
    44

    Re: Normals matrix

    My matrix may contain scaling factors... that is why I whant to know if there's a way to preprocess the matrix so that the normals don't have to be re-normalized after the transformation

  4. #4
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: Normals matrix

    The trouble is that in order to preprocess your matrix you would need to remove the scaling.

    If you have only uniform scaling you can use glEnable with GL_RESCALE_NORMAL, provided your normals are unit length to begin with. With GL_RESCALE_NORMAL, the GL computes a simple rescaling factor based on the modelview matrix.

    And then there's glEnable with GL_NORMALIZE for normals that are not unit length. This is just a brute-force normalization, post-transformation.

Posting Permissions

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