Jump to content
  • Advertisement
Sign in to follow this  
cmptrgy412

How to deal with coplaner polygons w/ same normal in csg union?

This topic is 4418 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

Hello, I am trying to do csg union on all the brushes I have, and I'm a bit confused on what to do when two coplaner polygons have the same normal. If I just allow them z fighting occurs and for some reason the entire intersection gets clipped if I push the polygon on the back, down the bsp tree. I've found only one resource on this subject, and it doesn't explain very good what to do in this case. Any help is appreciated. *edited for terminology used* [Edited by - cmptrgy412 on June 15, 2006 8:01:12 PM]

Share this post


Link to post
Share on other sites
Advertisement
If you have two coplanar planes with the same normal, you don't have two planes - you have two copies of one plane. In that instance, just delete one of them and you're golden.

However, that's a little too trivial, so I'm guessing you're actually talking about a more specific scenario, e.g. with clipped (non-infinite) planes -- or something else?

Share this post


Link to post
Share on other sites
Yes, sorry, I used wrong terminology. They're actually two polygons that are coplaner. I was in a bit of a hurry.

Here's a screenshot. I removed the polygon closest to the viewer, and as you can see there are 4 border polygons that remain.

http://img154.imageshack.us/img154/2007/coplanerpolys4sa.jpg

Now what I'm confused about is should these be clipped or well, ok if split the polygon, which I haven't shown in the screen shot, so that there are the same polygons. Which do keep? If they were the same texture, I don't think it matters, but if the level editor has 2 different textures, which do I know to remove.

Share this post


Link to post
Share on other sites
AFAIK the usual solution is to elect a winner; this can be done really any way you like that makes sense. Surface area is usually a reasonably effective candidate, but it might screw up detailed areas; for best results make that configurable or whatever.

Once a winner is elected, clip all polygons in the winner's plane by the polygon itself - that is, subtract the winning polygon from each of the "losing" polygons in that plane, using a standard CSG subtraction. That ensures no Z-fighting occurs between overlapping polygons, without getting into extremely complicated (and sometimes unsolvable) polygon merges.

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!