Volume Rendering

September 10th, 2008 . 18 comments

Some of you may be aware of the great work done so far by Raul Fernandez Hernandez (“farsthary“) concerning volume rendering in Blender. For those not in the know, rendering volumes of participating media as opposed to solid surfaces, has many uses such as realistically rendering smoke, fire, clouds or fog, or even with more complicated techniques, rendering volume density data such as MRI scans for medical visfualisation.

Raul completed a fair bit already, implementing this in Blender. Living in Cuba, where he doesn’t enjoy the same kind of connectivity as in many other parts of the world, it’s been difficult for him to participate in development and share his work. A few weeks ago, he emailed me asking for help with his code, and with maintaining it publicly. I promised I’d at least have a look at the first patch he was able to release and see what I thought.

In some spare time, I had a go at taking apart his patch. Unfortunately, it became clear that it wasn’t suitable for immediate inclusion. It was Raul’s first time coding in Blender (or perhaps in 3D) and due to this, wasn’t aware of some of the techniques available to make his life easier, or of how to integrate the code as cleanly as it could or should be. On top of this, working alone without being able to easily communicate with other developers, he’d been working hard on adding more and more features and options on top of a structure which I think could be done differently and a lot cleaner at a fundamental level. This led to some quite complicated code, and a tricky UI for artists to interact with.

I proposed to Raul that I start again from scratch, simpler and more cleanly integrated and then merge in what I could later down the track, step by step, to which he was very enthusiastic. He excitedly agreed with my invitation to work closely on integrating things like the simulation work he’s been doing, once a new structure is well defined. Recently in a few days off from work I sat down and started fresh, based on the approach in Physically Based Rendering.

Spot light in constant density volume

3 point lights in constant density volume

Textured spot light in constant density volume

 

So far I’ve got it working reasonably well with about 90% new code. Unlike before, it’s following a physically based approach, with a region of constant or variable density, calculating light emission, absorption, and single scattering from lamps. My aim is to get a simple, easier to use version ready, optimised for practical rendering tasks like smoke, fire or clouds. Once this is working perfectly, integrated cleanly and completely, and working in Blender SVN, further down the track we can think about adding some of the less common capabilities like isosurfaces or volume data sets.

Cloud texture controlling density, lighting from volume emission only

Cloud texture controlling density, 3 lights with single scattering

Spherical blend textures controlling density, directional light with single scattering

 

There’s still a lot to do – there’s one remaining bug with single scattering I must try and track down, and then there’s a lot of integration work to do, calculating alpha, rendering volumes in front of solid surfaces etc. Before too long I’ll commit this to the newly created ‘sim/physics’ SVN branch and work on it in there. I don’t know how long it will be before Raul is able to start working on this again too, since he’s under some horrible circumstances after hurricane Gustav ravaged Cuba. At least in the near term, I’ll be able to continue poking away at this in SVN.

Some things on my want-to-do list include:

  • Plenty of optimisations
  • Adaptive sampling – step size and/or early termination
  • Alternative anisotropic phase (scattering) functions such as Mie or Henyey-Greenstein
  • Wavelength (R/G/B) dependent absorption, so light gets tinted as it travels through a medium
  • An optimised bounding box or sphere ‘volume region’ primitive, which could be much faster than raytracing meshes as is done now
  • Multiple layers deep ray intersections, to enable concave meshes or volume meshes in front of volume meshes
  • Rendering Blender’s particle systems, either by creating spherical ‘puffs’ at each particle as Afterburner or PyroCluster do, or perhaps by estimating particle density with a kd-tree or such

I hope to be able to provide some more updates on this before too long!

§ 18 Responses to Volume Rendering"

  • what can I say, incredible! my favourite hybrid artist/coder is taking control of such an amazing feature!

    Raul’s been doing a great work, but now that you’re in we will start to see the real thing, I know that you, as an artist, will put our jaws in the floor with each video (as my jaw is on the floor now with that simple spherical blend texture being volumetric!).

    Also, you brought to us so many great features already! I know this is going to be great for you and for Blender, not only because of Volumetric rendering, but because of the exhaustive training this huge feature will give to you!

    Thanks a lot, your to-do list is very impressive, you should keep it for yourself! now we’ll start asking for more! 🙂

    cheers my friend!

  • Wahooney says:

    This is looking great already, I can’t wait for this to become more mature 🙂

    I’m keeping my eye on sim_physics 😀

  • Great initiative Matt.

    Rock on!!!!

  • Gustav says:

    This is fantastic news! Can’t wait until I can start playing with it for real.

    Good luck to both you and Raul

    /Gustav (I swear, I had nothing to do with that hurricane 😉

  • ibkanat says:

    Been looking forward to using this… I am sure glad that you are apart of making sure that it is done right and that it will make it into blender. Thanks

  • Sergeant Oreo says:

    I love reading about all the development of features

    in Blender, especially this one because physics are my

    favorite thing in Blender!

    I’m definitely keeping my eye on this…

    *Trys to unstick awe-struck mouth*

  • Farsthary says:

    Im sure with Matt guidance volumetrics will have a happy ending like a fary tale.

    Im publically thank you for taking this!

    Volumetrics are in good hands 🙂

  • ibkanat says:

    Farsthary thanks for all your work too

  • Georg says:

    Yes Fasthary, thank you for starting this project and taking it this far. I hope you dont’t stop coding!

  • chimericidol says:

    Hey Farsthary and Matt Ebb, thank you so much for you effort!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • IamInnocent says:

    It is great that Farsthary has the chance to learn with you. It is very generous of you, Matt, to undertake this. Farsthary will bring to the table his will and dedication of which he is not short in supply and I am sure that he will become a superb developer.

    Thanks to the both of you.

    Jean

  • Simon Clarke says:

    Farsthary Thank you for your initiative and enthusiasm. You will go far in Brokens company.

    gnomis

  • miecz says:

    Great work. Can’t wait to see it implemented in Blender. Can’t wait to see it in action.

  • James says:

    I’ve only got one thing to say about this. and that is

    WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOT!!!!!!

    I’ve been waiting and hoping for this feature since blender first hit the net years ago. The results you have up so far are great. It feels like christmas! Thank u SO much for joining in and working on this!

  • blendificus says:

    the rate at which you are posting updates to your branch in the CVS is AMAZING!!!! thank you for your work. I’ve even noticed build on graphical going up with your work in there already… SO EXCITING!!!

  • foreward says:

    This is a very exciting thing which may have further reaching implications than just volumetrics. With PBRT sneaking it’s way into the CVN perhaps we’ll start to see the technique in other places as well. PBRT has been a dream of mine since I first got into 3D illustration back when I was a kid, it’s very exciting to see it’s implementations.

Leave a Reply to James Cancel reply

Your email address will not be published. Required fields are marked *

What's this?

You are currently reading Volume Rendering at Matt Ebb.

meta