2008 was both a good and bad year for me. Back on March I started my tinkering in volumetrics: test here, test there, change little piece of blender code, compile, render….hm ,and the process starts over again. Then, by April I had some functional build and the rest is well known history
I have met many of blender users around the world, really good people willing to help even selfish requests like the BBB DVD that I enjoy every time volumetric allow me
Then, Nature struke my country with the same thing I was trying to simulate: 3 supervolumetrics hurricanes that literally devastated the blockaded Cuba. Imagine the consequences. Thanks to the help of many of the blender community,I and my family could recover to some extent and have a decent Christmas
And here is my present for all of you: while Im adding received-shadows support for sim_physics, I am also implementing a new algorithm for full Multiple Light Scattering calculations in seconds! I just sent the patch to the generous Matt Ebb for review and also for his magical touch and committance
So deep thank to everybody: I wish all of you a merry Christmas and happy year in 2009
proposal for the sim_physics branch
Multiple Light Scattering (MLS) in contrast to Single Light Scattering (SLS) used to be avoided in CG because it was a too cpu-intensive rendering method.
Indeed, the exact physical equations which govern light diffusion behavior inside a scattering media (clouds, smokes…) require lots of calculations per sampled voxel, typically involving spherical integrals (complex summations of properties over the spacial variables defining the direction around a voxel: latitude, longitude)–> cpu-time eater : concretely, for each voxel (point) inside a volumetric, one has to take into account both incoming and outcoming lights in ALL directions in order to have the right illumination for this voxel. For exact simulation this would require unlimited number of light contributions from a little sphere surrounding each voxel –> obviously not suited for production quality animations 😦
Several approaches have been made in order to simplify the equations governing MLS and to develop algorithms alternative to brute force calculation, in one word optimized ones:
1) SLS approximation, by neglecting the light directions which are not those of the main lights (that is to say neglecting the light scattered by other voxels in the neighbourhood). Indeed, diffusion is more visible inside the cones of the main lights of the scene. This works fine to some extent, but nature is not so simple. That ́s why when you look at a cloudy sky you can see that the edges of the clouds are brighter than the background. Indeed, water molecules of the cloud re-emit some light of the sun in all the directions up to the boundary of the cloud. As light travels more inside the clouds than on the border it is more absorbed, and thus some part of the clouds nearer to the sun than the sides seem paradoxically darker while the sides look bright because of the diffused light described in the previous sentence.
In many media (dense volumetrics) the contributions from other directions than the main lights ones are simply insignificant, thus we can go on there with SLS. However, in other ones the contributions from other directions can be very important (clouds, smokes), that ́s where we should go for MLS.
2) Monte Carlo simulation for path tracing inside volumetrics, random walk simulations and so: the sperical integrals are performed over random directions (the more there are, the best it is – otherwise the picture is dotty like a raytracing picture not matured enough)
3) others only take into account the boundary of the volumetric object (ex: the sides of the clouds), by neglecting the light coming from deeply inside the cloud (as most of it get absorbed)
4) Here I have implemented a different approach: since MLS is actually the light diffusion process inside participating media, I could approach it with a full semilagrangian diffusion simulation of the light inside the volumetric.
That way we could achieve several points:
a) Simulation is performed in the entire volume and baked so it’s pre-calculated for each sample voxel in a preprocessing step.
b) It does take into account contributions from All directions at no extra cost.
c) It’s relatively fast to calculate and only depends on the cache volume resolution (for most scenes it would only takes few seconds!).
d) Highly controllable by the user.
e) Physically based diffusion simulation.
Matt Ebb has previously implemented in Sim_physics the Light Cache, so the extension to include MLS its rather simple: The Light Cache is the input/output of the simulator and it only requires 3 parametters to control the MLS, (though some presets could be added)
a) light diffusion factor
b) time steps for the simulation
c) simulation steps
The MLS simulation is performed very fast compared with previous methods and the results are very promising 🙂
Again, images speak louder than words (the tiny squares are compression artifacts from the blog, the original pictures are clean)
Fig 1: Tiny volumetric Suzanne with Single Scattering (SLS)
Fig 2: Tiny volumetric Suzanne with Multiple Scattering (MLS) 10 simulation steps (2s in MLS sim)
Fig 3: Tiny volumetric Suzanne with Multiple Scattering (MLS) 20 simulation steps (5s in MLS sim)
Fig 4: Dense volumetric Suzanne with SLS
Fig 5: Dense volumetric Suzanne with MLS (2 secons in MLS simulation)
Fig 6: SLS volumetric sky – full scene antialiasing – render time : 17 min 48 s
Fig 7: MLS volumetric sky – full scene antialiasing – 18 min 5 s
Fig 8: SLS volumetric sky – full scene antialiasing – 17 min 35 s
Fig 9: MLS volumetric sky – full scene antialiasing – 17 min 45 s (so only 10s in MLS simulation) (here in high-definition)
MLS is a common effect in nature, by simulating them we could greately enhance realism in volumetric rendering and also increase the range of effects that could be achieved within the Sim_physics volumetric framework. The time overhead is very little compared to other MLS calculation methods and the results compensate with excess those few extra seconds. With this, blender will have cutting edge Multiple Light Scattering render capabilities 🙂