download: http://loonies.dk/demos/bin/lns-michigan.zip (sry, no source this time)
http://www.youtube.com/watch?v=nUwFYu8ANLQ
I guess this is more interesting in here than the normal ones...
Everything is done in compute shaders, there is no graphics pipeline in use.
There are 1 mill. threads running, each simulating a particle. When the particle has been updated (or maybe respawned) it is rasterized into a 32 bit combined z and color buffer (11+7+7+7 bit). No hard sync on the zbuffer (ie it's just if (z<zbuffer) zbuffer=z) , so it may be incorrect some places, but not very likely.
After this there is another CS pass (actually it's the same shader, just branching on different parameter values to save space) doing simple blur/glow post processing reading from the zbuffer and rendering on the screen.
Performance is almost entirely bound by number of particle-pixels, ie the rasterizing into a structured buffer part. So it's good to have many but small particles.
The scenes are defined as analytical distance functions (just like the slew of current ray marching 4kbs) - particles may be spawned at intersection points by ray marching from the camera, and they can be attracted to, get color from, or reflected on the surface easily. Particles are not interacting with each other, only the scene and some global affectors (turbulence, gravity, damping). Particles are respawned in a generational fashion, having 512 generations and a constant spawnrate per effect, and the spawn ratio between "screenspace" and "free" particles can be set.
Unfortunately is necessary to be ping-ponging the particle buffer, as it's not possible (I really can't see the hw reason for this) to loop dynamically (ie the rasterizing) based on values (the radius) from a UAV, so the read buffer has to be a SRV.
CPU is doing nothing but choosing the right line of 25 parameters from the script, update the constant buffer with these (and current time) and dispatch - it's consuming like 5 seconds of cpu time after the music has been generated (our gpu based synth is not ready yet).
Last edited by a moderator: