Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: issue of clipping plane with coplanar quad

  1. #1
    Junior Member Newbie
    Join Date
    May 2008

    issue of clipping plane with coplanar quad

    I had a simple box rendered with texture quad. I want to add a user-defined clipping plane along X axis, and part of the box will be clipped. The equation for the plane will be (1, 0, 0, value).
    The issue is when I set the value as min_x or max_x of the box, which means the clipping plane is coplanar with one side of the box, then this side of the box will have some artifacts. Say, if I rotate the camera, part of the quad is visible but the rest is invisible, and it flickers.

    Is there a way to always hide the entire quad of the box when it is coplanar with clipping plane without flickering?


  2. #2
    Junior Member Newbie
    Join Date
    Apr 2008

    Re: issue of clipping plane with coplanar quad

    This is a common problem when calculating with finite precision floating point numbers. The easiest way to force coplanar polygons to be kept or rejected is to offset your clipping plane by a small fraction by multiplying "value" by (1 +/- epsilon) for some small value of epsilon. Try with an epsilon around 1e-6.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2006

    Re: issue of clipping plane with coplanar quad

    This can have to do with where the clipping is occurring in the HW. If it is post projection, then you can definitely end up with more issues than if it were to happen in eye space as the GL spec states.

    One way to work around this is to output a varying scalar from your vertex shader (if you are using vertex shaders) that is the distance from that vertex to the clipping plane in eye space. In the fragment shader, if the distance is less than zero, kill the fragment.

Posting Permissions

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