I’ve got a problem with trying to draw transparant billboards. The problem is that I don’t know how to depth sort them correctly under all possible gl transformation matrixes. I have code for depth sorting made. What I have now is that it calculates the distance of each billboard to a certain point, that is extracted from the modelviewmatrix.
Now the problem I have is, that I can’t really calculate this point properly! I have no idea how to find this point, as everything I try doesn’t seem to work under all conditions, only under some.
Can someone explain to me what I should do? I don’t really know what the ModelView matrix does to glVertex3f coords passed. Are the coords first translated, then rotated? Or are they rotated, then translated? Is there anything special I should know about how the ModelView matrix affects glVertex3f coords passed?
I tried just extracting the modelview matrix translation values, but that didn’t work. I tried negative of the values, that didn’t work.
I tried just clearing the modelview matrix translation values, and then translating by what used to be the translation value. Because translations are translated after being warped by the rotation matrix, I can find out how OpenGL affects the translation, but that didn’t work either. I tried all sorts of different combinations of things, but none of them worked under all conditions.
Someone please? Multiple transparant billboards MUST have been covered before. Is there a webpage? Or even just a general depth sorting algorithm for blended primitives.