Compulsory sorting of triangles in an index- buffe

Miscellaneous Forums/Blitz Showcase/Compulsory sorting of triangles in an index- buffe

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Sometimes you can sort properly, sometimes you can't. If there are any polygons which are both in front of and behind another polygon, then you may not be able to sort them properly.

For example, if you have a car with four windows in it, you can sort those windows properly because every window's front and back, is completely on one side or the other of all the other polygons that make up the windows.

But if you have two quads crossing to make a tree, there is no way to sort them that they will always draw in the correct order, unless you have a vertex where they cross and split one or both of the quads.

Thisi is basically the same problem as building a BSP tree. In fact, that's what you're doing. You try to pick the next polygon to insert into the tree which results in the fewest splits, and when you're done you have some new polygons, but you can also draw everything without using a zbuffer and it will all draw correctly.