Archived

This topic is now archived and is closed to further replies.

XBTC

Depth sorting of transparent polys?

Recommended Posts

XBTC    122
Hi! Is there a fast + accurate method to depth sort transparent polys if I don´t have the center of the poly? The actual sorting is no prob I do it with qsort().... What I need to know is how to calc the distance between the player and the poly. I tried it with the plane equation but this dosn´t work in some cases(You can be infinetly far away of the poly but still be very near to it´s plane). Any ideas? P.s.: I tried it with the following method: I calculate the average of the distances between the player and the poly´s vertices. This gives me correct results, but I think it´s a waste of processing power....There has to be a faster solution.... Thanx in advance, XBTC!

Share this post


Link to post
Share on other sites
Orkin Man    122
Just find the center of the poly by averaging the polys vertices, and then find the distance between the result and the player.

Also you could also get a little more speed by dropping the sqrt in this case.

Share this post


Link to post
Share on other sites
XBTC    122
Hi!
Thanx for your help....

I already dropped the sqrt but averaging the vertices first would save some clocks.

P.s.: Perhaps I should use my bsp to sort the transparent faces but it is faster to traverse the tree without caring about the order and if I sort by texture afterwards it would only be a win for those few transparent faces.

Greets, XBTC!

Share this post


Link to post
Share on other sites