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

Thread: Frustrum Points Coordinates

  1. #1
    Intern Contributor
    Join Date
    Aug 2002
    Location
    SomeWhere Lost In France
    Posts
    75

    Frustrum Points Coordinates

    I would like to get (with a fast method) the points that limits the frustum (4 for the front near plan & 4 for the front far plan)
    I just would like coordinates of these point with a few instructions.
    I uses for the moment, the intersection plane from the planes got by multiplying projection & modelview matrix.
    But I'm not enough good in maths to get a fast solution
    Yes I need to learn
    But If anyone got a simple solution....
    Thanks
    I'm 4 and I draw

  2. #2
    Junior Member Regular Contributor
    Join Date
    Dec 2000
    Location
    Florence, Italy
    Posts
    219

    Re: Frustrum Points Coordinates

    take a look at www.markmorley.com

  3. #3
    Intern Contributor
    Join Date
    Aug 2002
    Location
    SomeWhere Lost In France
    Posts
    75

    Re: Frustrum Points Coordinates

    Yes it's exactly what I used, but it give only the planes for the frustrum.
    I would like to know if there is a fast method (like this one) to get points (instead of planes) of the frustrum.

    I think also this method gives the points in its core, but my maths aren't enough good to abstract this theory.

    Thanks
    I'm 4 and I draw

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: Frustrum Points Coordinates

    wich points? you mean the 8 edgepoints?

    well, search some code that intersects 3 planes and returns a point of this intersection.. do this for all 8 points with the right planes, and you're done..

    or you could backproject the unitcube..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

  5. #5
    Intern Contributor
    Join Date
    Aug 2002
    Location
    SomeWhere Lost In France
    Posts
    75

    Re: Frustrum Points Coordinates

    Yes thank you, but it's I used (intersection by three plane).
    But I've found an easier way to do with glUnProject (using ViewPort Limits).
    It works fine and it's faster than my algo using 3 plane intersection.

    Thanks anyway
    I'm 4 and I draw

  6. #6
    Junior Member Newbie
    Join Date
    Jan 2002
    Location
    Issaquah, WA, USA
    Posts
    12

    Re: Frustrum Points Coordinates

    The projection matrix transforms the camera space fustrum to a 2x2x2 cube centered at the origin (the clip cube). So to get the corners of the fustrum in camera space, transform the corners of the clip cube by the inverse of the projection matrix:

    [ inverse Projection ] x [ -1, -1, -1 ]
    [ -1, -1, +1 ]
    [ -1, +1, -1 ]
    [ -1, +1, +1 ]
    [ +1, -1, -1 ]
    [ +1, -1, +1 ]
    [ +1, +1, -1 ]
    [ +1, +1, +1 ]

    If you want the points in world space, then transform these points by the inverse of the view matrix.

    As for computing the inverses:

    - Appendix G of the Red Book gives the inverse of the projection matrix, if you have the l, r, b, t, n & f values.

    - You can probably find a robust matrix inversion routine with google, or search this forum. I'm sure its been mentioned before....

    - All the zero's in the projection matrix make it possible to solve for the closed form of the inverse. It takes a bit of algebra, but the result is probably more accurate than a general matrix inversion.

    - the view matrix is usually separable into a rotation and a translation, e.g. from gluLookat: TR, so the inverse is T'R'. finding T' is trivial. R is an orthogonal rotation matrix, so R' is just the transpose of R.

Posting Permissions

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