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: Reading normal vectors of a 3D model

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2008
    Posts
    6

    Reading normal vectors of a 3D model

    I have rendered a 3D model (available to me in the form of vertices and triangles), and I am able to use glreadpixels and gluUnproject to read the color and depth values of every point of the model that is visible from my chosen viewpoint.

    My application also needs the normal vector associated with each such point. Does OpenGL provide me a quick way to do this? Of course, I could try to locate in which triangle of the model, each point belongs and then get the normal corresponding to that face. But that would be slower.

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,932

    Re: Reading normal vectors of a 3D model

    Use shaders to output the per-pixel normal. It should be also possible by playing around with lights and or texture combiners, but shaders are the easiest way.

Posting Permissions

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