Merry Christmas to all and a present

Hi all,

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 semi­lagrangian 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 🙂

Merry Christmas to all and a present

25 thoughts on “Merry Christmas to all and a present

  1. Luis says:

    This looks amazing and the time it takes is so short!

    Would it be possible to use MLS directly on mesh objects? I see Suzanne, although I don’t know if MLS was applied directly to the mesh object or needs convertion to volume/voxels/etc.

    Thanks for all this, Blender will be huge with your contributions!


  2. Big Fan says:

    Thats a very good looking sky you made there (last pic).
    Your method certainly seems like a very useful implementation for the cost of just a little bit of extra time.
    Thanks very much for working on this and giving it to us for Xmas 😉
    I am looking forward to seeing all this great volumetric stuff in an official release of Blender real soon.


  3. amazing! results look great, but more importantly, render times look very reasonable! This has the makings of a great production tool )
    thanks for your fantastic work, under adverse conditions, even!


  4. Elam says:

    Hi Raul,

    Do you have links or PDF’s to any papers that you referenced for the voxels? The results are looking great. Appreciate the hard work!

    – Elam


  5. Dennis F. says:

    Hi there.
    Im using Vista and a 32bit-Build from

    I found out, that my Blender slows down very much by using the selfshadow-cache function.
    It seems that this cache never will be cleaned and fills more and more with each frame.
    By rendering an animiation Blender PreCaches the Volumes about 7 times.
    Is there a bug or am i doing something wrong?

    Thanks for that stuff :)!


  6. Ruddy says:

    Hi Dennis,

    I think that this not yet optimized for animation:
    Q: “I was wondering if the light cache is calculated per frame, or if it is a one time deal. Thanks! ”
    A (from Matt Ebb): “Right. It’s per frame – I suppose in the future it would be possible to save it to a file, to use for an animation or test renders, if the lights/material aren’t changing, but not yet “


  7. Ruddy says:

    Hi Elam,

    As far as I know, Raul has used the same approach as in his fire simulator (semi lagrangian), so it must have found this method by himself (although that does not mean that other people haven’t done the same)
    He has transposed an often used algorithm in fluid dynamics in the light scattering field. He has told me that he was first student in physics (that he really enjoys) before going on with computer science, so he has strong bases


  8. Dennis F. says:

    Ruddy thank you!
    Would love to see a full working version into blender.
    Whant to use it for a visual effects demo reel ;).

    What does this Voxel-Texture- and how do i use it (iE with the simulator bin oder with that voxel-exporter-script)- do i need a domain or a particlesystem like the PontDensityTextur?
    I didn´t find any HowTo´s about that issues.

    Thank you!!!


  9. Ruddy says:

    Hi Dennis,

    the voxel texture (bin) is not optimized yet (ex: no compression > huge files): optimizing is what Farsthary is currently doing…

    Volumetrics require a domain to restrict calculation along rays: indeed, this is cpu-intensive as it must calculate how much ray properties are modified every x distance, where x is the value entered in the “step size” area at the top of the volumetric panel (material windows, sim_physics branch)

    0) activate “ray” in the render window
    1) put a mesh as a domain (activate “volumetric” in the “material” windows, “link and pipeline panel”, there is a button at the bottom (under render pipeline butons) with “solid”: click on it and select “volumetric instead.
    2) put the volumetric texture inside: either the empty which will be the spatial reference for the “smoke.bin” texture from the simulator (download the example file in a previous post (“concretely?”), or a plane which emits particles if you want firework effects.

    Matt Ebb has kindly put online example files:

    So go on , download a sim_physics build, then study this file:
    you see that the emitting particles plane is inside the cube with volumetric activated, and that there are lots of new options in the texture window (“point density, modifier): just play with it


  10. Dennis F. says:

    Thank you 🙂 but i found out how to work with Point Density Textures.
    My problem is: i tryed using voxel data an didn´t get any results.

    made a domain
    added a empty
    gave the domain a Voxel-Texture
    And this Voxel-Texture need a file as input.
    I tryed that 100MB-BIN, and i tryed a voxeldata-file that this VoxelExporter-Scipt exports.
    I maped that texture to “object > empty”.

    But it doesn´t matter what i do. I don´t get rersults by rendering.

    Can i get the same good effect with PonitDensity as like as i would use voxel-data?

    Greets and thanks!


  11. Ruddy says:

    Ok, I have also met some issues because the smoke density in “smoke.bin” is pretty low: you have to “boost” it in the “material” menu (density, absorption.. see the settings in the example file from “concretely?”)


  12. Dennis F. says:

    amazing! Okay thank you Ruddy!- i found my mistake :).
    VoxelData is faster rendered than PointDensity- but i think that is because the settings- i have to test some different settings.
    My finished animation will be uploaded to myvideo- i can if you whant send you a link- so other people can see :)?!?

    Am i right: VoxelData just fills a domain at this time- but can NOT colidate with anything and isn´t abled to react on moving the empty (like a candle-flame) ???

    I love your work 🙂



  13. Ruddy says:

    Hi Ruddy,

    glad that you’ve solved your issue 🙂
    you don’t have to thank me (except for some help), thank devs Matt Ebb and Farsthary instead 🙂

    You ‘re right about the voxeldata, as it is baked outside blender (mere stacked 3d textures). Although the external solver can intrinsically accept different boundary shapes and force field, currently only the cube is available (whose size is those of the empty put inside the cube) and only gravity and buoyancy are considered, respectively: this is why this is important to support a dev who will integrate thightly the simulator with other blender physics tools (see last post).

    So if you want some interactions, particle system is the appropriate tool, even without volumetrics:


  14. Dennis F. says:

    *lol* …
    Yes you are right, the particlesystem is very hot ;).
    I know many things from it- and i tryed different things with it.

    Ill try to make a realistic fire, smoke with PointDensity.
    But that Detail i would have with Voxel-Data is not possible in that way.

    So, hope a collidatable simulator will be added to blender :).

    Of course, thank you for your help, and thank to all programmers and build-makers for their great work!!!!

    I take every day a look here, for some new stuff in my demoreel ;).



  15. camilo says:

    Sweet stuff, good work. I passed xmass on Cuba w/ my family, I even passed by uci and met a friend, her name is Gisela and she’s a first year informatica student. I also know an old friend named Hector Luis is studying the same at uci. Hopefully the new U.S. president will change things (as said) and I’ll be able to visit more often, hope to meet you sometime. Cheers.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.