Jump to content
  • Advertisement
Sign in to follow this  
marie

question about clipping plane

This topic is 3772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I had a simple box rendered with texture quad. I want to add a user-defined clipping plane along X axis, to cut part of the box. The equation of 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 cut the entire quad on the side of the box when it is coplanar with clipping plane without flickering? Looking forward to your help. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Not as far as I know. When they are co-planar you will always get floating point roundoff errors. Even if you had extremely accurate floats, if the clip plane is exactly co-planar with the polygon you will get errors.

Share this post


Link to post
Share on other sites
Thanks for your reply.
BTW, do you think disable depth buffer or set polygon offset would help?

Share this post


Link to post
Share on other sites
Disabling the depth buffer would not help since AFAIK clipping is done before the z-test. Polygon offset could help in that case but might cause the same error when using a value other than min_x or max_x.

I'm not sure if you can influence clipping that much using the fixed function pipeline. When using shaders you could perform custom clipping and use some epsilon value for more robust floating point comparisons (e.g. x == y would become abs(x - y) < epsilon -> x and y are equal if they don't differ by more than epsilon, which could be something like 0.000001f).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!