Advertisement

Particle System Depth Test?

Started by March 01, 2002 06:26 PM
12 comments, last by ShCiPwA 22 years, 11 months ago
i recall hearing that a natural mergesort is quite good as well (can''t remember complexity off the top of my head... O(lgN) or sumfin?)...

anyway, the good thing about natural mergesort was that it is way faster than things like quicksort for datasets that are already close to being in sorted order (in which case quicksort displays worst-case behaviour of O(N*N). This is very likely to be the case if you take advantage of frame-to-frame coherency (ie objects'' position won''t change much between frames)
The Radix Sort is the fastest I have seen. Processed more than 110K or points in under 1 sec on a PIII 500.

The radix sort works by passing through the data 4 times. completely. out doing most like the bubble sort. What makes it even faster is there is not compairisons done.

Do a search on google for float radix sort. There is one search result that produces a Radix Sort Revised title. That is the most interesting one. It handles floats. Because If you did not know you can not use the shift operand on a float. Well not in C/C++
But he handles it in a macro. And created some nifty little checker to see how many times it needs to pass through the array.
Creating the index table only once.


--What are you nutz?I have nothing to say to your unevolved little brain. The more I say gives you more weapons to ask stupid questions.
Advertisement
Well, if you are using additive blending, you don''t really need to depth sort. Subtractive blending would work too, but if you try to mix additive and subtractive blending you might see some anomalies due to the values being clamped to 1.0 or 0.0

Additive only adds to color values, making them brighter, while subtractive blending subtracts. Additive is good for stuff like fire and lens flares, while subtractive blending would probably be good for stuff like smoke.
Just thought I''d chime in about the radix sort for the benefit of non-cs people in the crowd:
useable: when unique values need to be sorted in numerical order (lexicographic order actually but I''m keeping this basic)
pros: sometimes faster than quicksort and such
cons: requires additional memory (equal to the size of all the values to be sorted), may be slow if the values to be sorted are long

This topic is closed to new replies.

Advertisement