Originally posted by Venom
http://photo.starblvd.net/Star_Dragon/2-2-5-1059154817?m=0&pg=1&ro=1&co=4
as you can see, intersecting polys are bad, that's what lead to this big clipping problems ( which is why I'm battling for that to be fixed by the SCP people, coz intersecting polys saves a LOT on the polycount, and hence could help for better frame rates ).
Complicates z-buffering, IIRC. Because you have to subdivide the polygons to try and resolve occlusion.... in other words, you need to create more polygons (during the z0buffer process) to ensure one is clearly behind another.
I think (going from memory), the z-buffer process works roughly like this;
1 - All faces are sorted in order of their max -z-depth (i.e. furthest away is the top of a stack, and draw first)
2 - ambiguities are resolved (see below)
3 - Faces on the stack are drawn - wiuth the furthest away first, and the next furthest, etc. aka 'painters algorithm', because the close polygons are drawn on top of the far away ones.
Z-buffer tests
(stack ordering)
- 5 tests, to resolve if P is behind Q and thus drawn first (NB: I tend to get P & Q mixed up... but the principle is clear). If a test
fails, then P is defintely behind Q and drawn first. If all test fail, it is ambigous whether P is behind, so P & Q are reversed and the tests re-ran (to see if Q is behind P) - aflag is also set*.
Tests are;
1/ Check if the x-extents overlap
2/ Check if y-extents overlap
3/Check if one object is completely closest to the camera (z extents)
4/Check if one object is completely closest from the camera (z extents)
5/ Check if the projections (conversion to 2d screen co-ords) overlap
*- If the test fails a second time (i.e. if the z-order is ambigious - i.e. intersecting polies), the z-buffer needs to divide P & Q in half (into 2 seperate polys), and rerun the z-buffer algorithm.
- In other words, it needs to keep subdiving the faces until it has a set of faces with ambiguities. I think in the case of intersecting polygons, you might need quite a few subdivisions at the intersecting points, so I'd imagine it wouldn't have the performance improvement you might want. someone with a bit of experience in this (I've never coded 3d, only done theory....) and probably correct me or give a better opinion......