Thursday, 21 April 2011

Volume Scattering Is Cool

Without scattering

With scattering
A big part of the look of explosions is the very hot bright interior light being scattered (i.e. blurred) as it travels towards the eye and is attenuated by the surrounding smoke. These images are from a work-in-progress real-time explosion simulation and show the benefit of adding approximate volume scattering.

I'm using the slice-based scattering technique from the volume rendering chapter in GPU Gems 1 by Joe Kniss et. al. This is one of my favourite tricks, and is the same technique I used in the old smoke particles sample in the CUDA SDK. The main difference here is I'm always drawing the slices from back-to-front, instead of using the half-angle direction. It turns out for emissive volumes like explosions, where most of the light is from the inside,this works pretty well. It's quite a lot slower than doing ray marching in a pixel shader (lots of passes, and you're blending in the frame buffer), but I think the results are worth it.


sebh said...

Nice adaptation of the half angle slice method! :)

I always wondered what would be the result of using a light propagation volume as the one for global illumination on volume data.

Using a lower res grid than the actual volume effect and taking into account attenuation of light depending of 'smoke' density...

Could this match with the method you are using?

goofoo said...
This comment has been removed by the author.
goofoo said...

Very cool. You can send source code for study? Now i can try write gpu fluid plugin for maya, maube your example help me. Thanx

Simon Green said...

sebh - good idea, using a "light propagation volume"-like technique would work too. it might also be more efficient, and would propogate the light in all directions, not just towards the camera. just render the illumination to a low-res volume, blur in 3 dimensions, and then use for lighting. i might try this!

goofoo - not planning on releasing source code yet, but you might want to check this out:

Simon Green said...

BTW, I uploaded a video of this here:

eight said...
This comment has been removed by the author.