View Full Version : Good way of sorting my transparent objects??

01-10-2002, 05:42 AM
As the subjects says Im looking for a fast and easy way to sort my transparent object from front to back.
Just to sort them from greatest z to lowest z-values seems to be quite easy, but it must be in direction to the viewport, so it gets quite difficult.
How do you do this?? Please give some hints...

01-10-2002, 06:12 AM
BSP (binary space partitions) could be use to get this, I think.

01-10-2002, 07:56 AM
The brute force method is to simply solve for each z in eye-space and sort using those values. Though this method is not necessarily perfect either, unless you go one extra step and split any intersecting objects before sorting. Of course if you are certain there will be no intersecting objects then you could skip the splitting step.

01-13-2002, 04:44 AM
Ok then.
How do you solve for each z-value??? I dont have an idea....

01-13-2002, 05:18 AM
You have to do the same object to eye transformations for each vertex that you would have OpenGL do, except you can do them partially (just for z only) if you want. If you want to reduce the workload even further, you may calculate the centroid of each triangle in object space, and only transform those. Sorting by centroids can add an extra bit of grief to things, but usually works "good enough".