As the subjects says I´m 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…
BSP (binary space partitions) could be use to get this, I think.
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.
How do you solve for each z-value??? I don´t have an idea…
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”.