PDA

View Full Version : Z-Sorting



Vasko
07-02-2006, 01:40 PM
Hi, I have never had the issue with rendering transparent surfaces, but now I do, and I would like to ask how did any of you tackle this issue?

Thanks.

- Tim

ZbuffeR
07-02-2006, 02:07 PM
Sorting each triangle is often too expensive and not needed, you may go for a coarser sort grain.

- sorting only per object, draw backfaces first then front faces, or skip backfaces.
- for additive particles effects, no need to sort
- for substractive black particles (smoke) no need to sort
- dust/dirt/clouds particles need proper sorting. You may want to avoid quicksort as there is quite high frame-to-frame coherence.

Ido_Ilan
07-02-2006, 10:58 PM
You could just do fast "bucket sort".

Divide the z-depth to several slices and put each triangle(by it center) in the correct bucket.
512 slices would be enough for most geometries.
It will be fast.

Ido

Vasko
07-03-2006, 12:27 PM
Thanks guys. I think I like the "bucket sort" idea, it seems easy, and doesn't seem to have huge overhead (superficial thinking right now).

I will go implement it now.

Thanks again.
Tim