CS513 Assignment 4.3: Blended Particles (Sorting on CPU)
by Muhammad Karim
General Configurations:
   # Development Platform: Windows Vista, Visual Studio IDE, Debug+Release build
   # Used OpenFrameworks library
   # CPU: Intel Core2Duo 2.24 GHz
   # Graphics Hardware: ATI Mobility Radeon HD 3470 (OpenGL 2.1)
-
Particle Rendering Results:
Particles Sorted in CPU using HeapSort
Comparison between unsorted (left) and sorted particles (on right blended correctly)
Depth peeling in 4 depth layers
The scene was rendered in 4 depth layers, the debug renderings are shown
Depth peeling result
The objects seem to be rendered correctly, but not particles-to-particles!
-
Timings for Blended particles with or without sorting
FPS was recorded after 5 seconds from starting the application to let the particles move around and get stabilized.
All times are in seconds.
| # of Particles |
CPU Update without sorting |
CPU Update with Heap sorting |
| 64x64 |
130 |
131 |
| 128x128 |
85 |
87 |
| 256x256 |
34 |
35 |
| 512x512 |
22 |
8 |
-
Discussion:
-
Particles were blended using OpenGL blend function (SrcColor*SrcAlpha + DstColor(1-SrcAlpha)), particle textures with alpha channel was used.
-
Particles were sorted in CPU using Heapsort algorithm, which provied decent performance. But not that good when particles counts >> 256x256.
To sort the particles I used the depth values for comparison and only swapped the indices in the vertex indices array. So, I could still
draw all the particles with 1 glDrawElements() call even after sorting.
-
Comparisons were made between sorted and unsorted particles, and the difference was apparent (image shown above).
Did a lot of work to get depth peeling to work with 4 depth layers. The objects other than particles seemed to work well, however particles
were not correctly working, I could assume that there was some texturing issues on depths other than 0, and particles in depths > 0 were not being
rendered correctly on the layers. Could be a multitexturing issue in the particle shader I used, I need to dig more in it.
-
Depth comparison in shaders: I needed to use some epsilon value added with the previous depth value (that was accessed
from a depth texture) to make the depth comparisons to work correctly. A technique similar to shadow mapping was
used to compare the depth values.
-
Even though depth peeling did not work with particles, the implementation seemed significantly slow, especially
with the particle shader and with 4 layers of depth.