Tuesday, August 19, 2014

Who wants to see some shadowed particle systems?

Awww yeah, I made some neat particle systems with volumetric shadowing!

This first one uses the technique here: http://docs.nvidia.com/cuda/samples/5_Simulations/smokeParticles/doc/smokeParticles.pdf


The hardest part of this was definitely implementing a GPU radix sort. My recommendation: don't. The hard parts are always, always in the details (calculating those local offsets, I know right).


Particle Shadow Mapping

Because the technique above is kind of bad with multiple viewing angles (note that I don't pan all the way around the particle system here), I ended up implementing a different technique: https://developer.nvidia.com/sites/default/files/akamai/BAVOIL_ParticleShadowsAndCacheEfficientPost.pdf

Particle shadow mapping is rendering the particle system into a 3D texture and then using a compute shader to propagate the light transmittance though that 3D texture. This one is a lot more stable and also probably faster. It still requires sorting for the final rendering, but doesn't require sorting for the shadowing information.


The performance is kind of bad but that's just because of Unity not being able to cope with sorting 50k particles. I'm going to get the GPU radix sort working with this one too, but it's not currently in that video. If only CUDA worked on both AMD and nvidia, I'd just be able to use their library to do this sorting stuff, but NO. This is why we can't have nice things.


Bonus

Guess who owns shitty.fish? Yeah. I bet you didn't even know that .fish was a top level domain.