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

Thread: Transforming Normals and Lights

  1. #1
    Guest

    Transforming Normals and Lights

    When I setup my modelview and projection matrices, vertices are transformed by the (PM) matrix while normals are transformed by (PM)T^-1 according to the Red Book.

    However, I noticed that if translation is included in the normal transformation, things go awry since they would then be skewed and quite un-normal. (Incorrect orientations even if you renormalize, though) Would it then be prudent to keep handy two matrices for when I want to work with transformed normals--one that includes all the transformations required, to apply to vertices, and one that includes only rotations, to keep normals on track?

    Also, I want to play with lighting. Does "hardware T&L" imply that the OpenGL lighting system is hardware accelerated or should I write my own lighting system to keep track of lights and use vertex and fragment programs to do the result calculating?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2002
    Location
    philadelphia, pa, usa
    Posts
    109

    Re: Transforming Normals and Lights

    translations don't affect normals. a vector is defined as [x y z w], and since the w component of a normal is 0, translations (which are stored in the fourth column of a transformation matrix) have no affect on normals. i would recommend using the fixed function pipeline and letting opengl do the transformation and lighting calculations for you before messing around with vertex and fragment programs.

Posting Permissions

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