Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: User Clipping planes on GF4

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    User Clipping planes on GF4

    Ti 4600.

    I've trying to render my scene to a texture for a water effect. It works well, but i need one user-defined clipping plane to avoid drawing pixels over the water plane, when drawing the reflection.

    I thought that clipping planes were hardware accelerated at the expense of 1 TMU for 2 clip planes. I only use TMU0 for diffuse texture maps, and it's slow as hell. We're speaking of a framerate drop from 100 fps to 5 fps here, with standard opengl calls or with VAR, no matter.

    I could use pixel shaders and the texkill instruction to do that, but i want to know if there's a work around first. It just seems overkill to use pixel shaders for that SIMPLE effect! Maybe a ZBuffer trick? Any idea?

    Y.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    San Diego, CA, USA
    Posts
    769

    Re: User Clipping planes on GF4

    On Geforce3/4, geometry-based clip planes are slow. It sucks. If you want to clip geometry, it's better to do it yourself before sending it to the card.

    If you want to use texture units and auto texcoord generation to clip geometry, you have to set it up explicitly, not through the glClipPlane mechanism.

    -- Zeno

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jul 2000
    Posts
    205

    Re: User Clipping planes on GF4

    I found that you can use the near clip pane as an arbitrary plane by modifying your projection matrix like this:

    p[0][2] = plane.x
    p[1][2] = plane.y
    p[2][2] = plane.z + 1
    p[3][2] = -plane.w

    This is for an infinite projection matrix (no far clip pane).
    As you would expect, z precision suffers at grazing angles and if you work it out you'll see that this matrix doesn't always use the full upper NDC range for depth, I have come up with a way to improve this but it's kind of messy. I know it's not a very complete answer but it works. I wanted to research it more but I haven't had the time. I have done some research and I do use it so I suppose I could tell you a little more if you want.
    I also have a ti 4600 but I'm quite confident it'll work on any card (it's just a matrix).

    P.S. forget user clip planes on consumer hardware, the terrible performance is the least of it, try doing some multipass...

  4. #4
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,444

    Re: User Clipping planes on GF4

    I'm pretty certain slow performance on user clip planes is a nVidia thing only. Several ATi demos use it and it seams to be fast enough.

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: User Clipping planes on GF4

    Thanks for the answers. I have no speed loss on ATI cards, only NVidia. Madoc, i tried your projection matrix trick, and it works to some extent.. but there's some horrible kind of popping ( i suppose Z-Fighting ) in the reflection, and i haven't find any good set of parameters to lessen it. It's just not usable as it is now Zeno, i can't do the clipping myself, it would just be too slow (the scene is non-trivial). How do you set up explicitly a clip plane ( i just need one ) ?

    Y.

  6. #6
    Junior Member Newbie
    Join Date
    Jan 2002
    Posts
    15

    Re: User Clipping planes on GF4

    I use stencil buffer when I draw the water plane ...

  7. #7
    Intern Contributor
    Join Date
    Mar 2001
    Location
    Duplje, Slovenija
    Posts
    76

    Re: User Clipping planes on GF4

    Did anyone get user defined clipping planes to even work with ARB_vertex_program (with position invariant option) on nVidia HW?

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Posts
    748

    Re: User Clipping planes on GF4

    Gdo, i also use the stencil buffer, but that is not the problem. You need to clip the geometry that is under the water level (or upper the water level when it's reflected) to get correct reflections.

    Y.

  9. #9
    Advanced Member Frequent Contributor
    Join Date
    Dec 2002
    Location
    Espoo, Finland
    Posts
    599

    Re: User Clipping planes on GF4

    Can't you just use an 1d-texture and alpha test to do the clipping? You know, like what you would do to eliminate backprojection with projected shadow textures.

    Basically use eye-linear texGen and an 1d-texture with nearest filtering to give zero alpha to fragments below the water level.

    -Ilkka

  10. #10
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: User Clipping planes on GF4

    I used a user clipping plane in this demo: http://www.delphi3d.net/download/texreflect.zip -- runs at 140 fps on my GF4...

    -- Tom

Posting Permissions

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