Results 1 to 5 of 5

Thread: Clipping planes

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000

    Clipping planes

    I'd like to add some rough view-frustum clipping to my terrain renderer. The problem is: how can I get the 6 standard clipping planes coefficients?
    I have two ideas:
    first, calculate them as if I were in the origin lookin down the z-axis (default), then use the current modelview matrix to transform them correctly.
    Second: I don't know, maybe there's a way to ask OpenGl about them, or another way to do frustum clipping.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Feb 2000
    milano, italy

    Re: Clipping planes

    why don't use frustum bounding sphere instead of frustum planes?

    maybe is better, since with a single test you can see if polygon or object is near the frustum...


  3. #3

    Re: Clipping planes

    Use glFrustum. Specs for example at

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2000

    Re: Clipping planes

    I mean I'd like to clip objects before sending them to the rendering queue. I could consider the idea of using spheres, but I still need to take into account the planes that define the view frustum.

  5. #5

    Re: Clipping planes

    Ohh... Then you have to make your own frustum calculations. I guess you can't directly access the OpenGL clipping planes.

    fovy = vertical fov
    aspect = aspect ratio (width/height)
    nearz = distance from near clipping plane
    farz = distance from far clipping plane

    sy = sin(fovy*0.5)
    cy = cos(fovy*0.5)
    sx = aspect*sy
    cx = aspect*cy

    plane[0] = (sx, 0, cx, 0)
    plane[1] = (-sx, 0, cx, 0)
    plane[2] = (0, -sy, cy, 0)
    plane[3] = (0, sy, cy, 0)
    plane[4] = (0, 0, 1, znear)
    plane[5] = (0, 0, -1, zfar)

    This is the frustum in view space. If you want to do clipping in object space, you need to transform the frustum into object space first.
    For this you need to transform the plane normals into object space. You also need some points on the planes, so transform eye point (0, 0, 0), near point (0, 0, znear) and far point (0, 0, zfar) into object space. Then calculate the plane equations.
    So, you need to implement all this matrix stuff etc. yourself.

Similar Threads

  1. clipping planes
    By bloto in forum OpenGL: GLSL
    Replies: 8
    Last Post: 07-21-2004, 10:03 AM
  2. Clipping Planes
    By in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-13-2004, 10:05 AM
  3. Clipping planes with Cg
    By rviney in forum OpenGL: GLSL
    Replies: 6
    Last Post: 03-02-2004, 11:00 PM
  4. Clipping planes with Cg
    By rviney in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 01-13-2004, 10:28 PM
  5. Replies: 1
    Last Post: 09-02-2003, 01:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean