Participating media

Sep 11

Mitsuba 0.3.0 released

I’ve just released Mitsuba 0.3.0! In hindsight, my previous announcement of a release within 1-2 weeks clearly turned out to be a bit too optimistic… But I hope that it was worth the wait. In addition to all the previously mentioned features, I’ve worked on the following changes:

Python integration: Mitsuba 0.3.0 comes with Python bindings. While the bindings don’t expose the full C++ API, they are already good enough for controlling the renderer, dynamically constructing scenes, and many other useful things. Chapter 11 of the documentation contains a basic overview and several “recipe”-type examples. My main motivation for adding bindings is to reduce the amount of work that is necessary to integrate Mitsuba into commercial modeling tools. I found that since I don’t do any modeling myself, I’m not particularly good at developing such plugins :). I hope that a solid Python API will lower the bar enough so that someone else can give it a shot and succeed.

Integrator overhaul: Some of the integrators in Mitsuba (photon mapping variants, irradiance caching, subsurface integrators) have become somewhat broken due to the many changes that happened over the last months. These are all fixed in the current release. In addition, the photon map-based integrators are now about twice as fast, which is a consequence of switching to a more optimized generic point kd-tree implementation.

Preetham sun/sky & Hanrahan-Krueger models: As part of his thesis (link) on realistic rendering of snow, Tom Kazimiers has developed a great series of extensions to Mitsuba. I’m planning to eventually merge most of them. For now, I’ve added his implementation of the Preetham sun/sky model, as well as an implementation of the Hanrahan-Krueger BSDF (which is an analytic solution to single scattering in a layer of a homogeneous medium). Marios Papas greatly extended the H-K model implementation and verified its correctness against reference simulations.

API reference: A nightly process now creates API documentation for the most recent Mitsuba version. Take a look at The API documentation is also linked from the main Mitsuba web page.

Better builds: I’ve grown a bit tired of making release builds and packages for various platforms, since it tends to be a tedious manual process.

To reduce this burden, I’ve set up seven virtual machines that automatically download the latest version of Mitsuba, compile it, and upload packages for:

  • Windows (x86 and x86_64)
  • Mac OS 10.6+ (universal binary for x86 and x86_64)
  • Ubuntu 10.10 — maverick (x86_64)
  • Ubuntu 11.04 — natty (x86_64)
  • Debian 6.0 — squeeze (x86_64)
  • Fedora Core 15 (x86_64)
  • Arch Linux (x86_64)

This set should hopefully cover almost everyone (I’m assuming that any sane Linux user has made the switch to 64-bit at this point). Most of the packages also include development header files, which makes it possible to create custom Mitsuba plugins without ever having to compile the main codebase.

The Windows and MacOS X builds are compiled using the Intel C++ compiler 12. This means that OpenMP now finally works on OSX! (Apple has been shipping a seriously broken version with their compiler for years..)

Since the entire build process is now automated, you can expect to see more frequent releases in the future — I might even switch to a nighly build system at some point.

Future license change: I intend to switch Mitsuba’s license to the more liberal LGPL license (a.k.a. the “lesser GPL”, or “library GPL”) at some point in the near future. This will essentially allow users to write proprietary plugins or link Mitsuba to external applications without having to release their source code. Only changes to the renderer itself would need to be made available. I believe that this is a good compromise between making the system available to a larger group of users, while benefiting from any improvements that are made. The transition will involve getting permission from a few more people, rewriting code, and replacing certain dependencies. For that reason, it might still take a few months. Stay tuned…

Better documentation coverage: A huge amount of work went into the documentation, which now covers many previously undocumented plugins. While still far from complete, it’s at a point where it can serve as a good starting point and reference for every-day use. Be sure to check it out if you are using or evaluating the renderer in any way.

Jun 11

Mitsuba 0.2.1 released

After a long development cycle, I have just released a new version of Mitsuba. Please read on for a list of changes (these are in addition the ones mentioned in this Blog entry).

  • Participating Media: the most significant feature of this release is a complete redesign of the participating medium layer in Mitsuba. This change was necessary to remove limitations inherent in the previous architecture, which was overly complicated and could only support a single medium per scene. The new Mitsuba version handles an arbitrary amount of media, which can be “attached” to various surfaces in the scene. For instance, rendering a bottle made of  absorbing colored glass now involves instantiating an absorbing medium and specifying that it lies on the interior of the bottle’s glass surface.

    Apart from these changes, the new implementations are also significantly more robust, particularly when heterogeneous media are involved. In a future blog post, I will provide more detail on the rewritten participating media layer.

  • Micro-flake model: Mitsuba was used to create the high-resolution volumetric cloth renderings in the paper “Building Volumetric Appearance Models of Fabric using Micro CT Imaging” by Shuang Zhao, Wenzel Jakob, Steve Marschner, and Kavita Bala.

    This project was a *big* challenge for the micro-flake rendering code and led to many useful changes. For instance, the code previously made heavy use of spherical harmonics expansions to compute transmittance values, and to importance sample the model. For very shiny materials (such as the cloth models we rendered), this can become a severe problem due to ringing in the spherical harmonics representation. The rewritten model has fast and exact importance sampling code that works without spherical harmonics, and it uses a high-quality numerical approximation for the transmittance function.

  • Irawan & Marschner woven cloth BRDF: This release adds a new material model for woven cloth, which was developed by Piti Irawan and Steve Marschner. The code in Mitsuba is a modified port of a previous Java implementation. A few measured patterns shown below are already included as example scenes (many thanks go to Piti for allowing the use of his code and data!)

    This model relies on a detailed description of the material’s weave pattern, which is described with the help of a simple description language. For instance, the description of polyester lining cloth looks something like the following:

    weave {
      name ="Polyester lining cloth",
      /* Weave pattern description */
      pattern {
        3, 2,
        1, 4
      /* Listing of all yarns used in the pattern (numbered 1 to 4) */
      yarn {
        type = warp,
        /* Fiber twist angle */
        psi = 0,
        /* Maximum inclination angle */
        umax = 22,
        /* Spine curvature */
        kappa = -0.7,
        /* Width and length of the segment rectangle */
        width = 1,
        length = 1,
        /* Yarn segment center in tile space */
        centerU = 0.25,
        centerV = 0.25

    For more details on this model, please refer to Piti Irawan’s PhD thesis.

    Due to its performance and expressiveness, I believe that this model is of genuine utility to a larger audience and hope that including it in Mitsuba will increase its adoption.

    A cool feature that I might add in the future is an interactive editor to design new pattern descriptions with a live preview.

  • Amazon EC2: This release adds a launcher script to create virtual render farms on the Amazon Elastic Compute Cloud (EC2). This is very useful when rendering time is critical, since EC2 can give you essentially infinite parallelism. I will write more on how this works in a separate post.

  • Blender Plugin: Due to its experimental nature, Blender 2.5x has been a bit of a moving target, making it difficult to develop stable plugins. Recently, a large batch of changes broke many plugins, particularly custom rendering backends. Since then, I have been working on restoring compatibility with Blender 2.56, which is mostly complete at this point. Some work remains to be done, hence I will release the final Blender plugin in a few days.

  • Build system: The build system has undergone several cleanups:

    1. Binaries are now placed in a separate directory instead of being co-located with the source code. (build/release or build/debug depending on the type of build)
    2. The distribution now supplies project files for Visual Studio 2008 and Visual Studio 2010 with support for code-completion, debugging, etc.
    3. Builds with Visual Studio 2010 now work correctly (they used to be prone to crashes), and the release adds support for the Intel C++ compiler 12 on Windows.
    4. The compilation flags for the Intel C++ compiler have been adjusted so that the binaries also run on some older AMD hardware that doesn’t support SSE3.
    5. The config directory was removed.

    To upgrade to this version without making a mess of your repository, I recommend to clean before updating, i.e.

    $ scons -c
    $ hg pull -u

    If you forgot that step, old .obj/.os files and other build products will probably litter your source tree. In that case, it might be easiest to check out a clean copy.

    If you are on Windows or OSX, note that you must also update the dependencies repository.

  • Beam Radiance Estimate: Mitsuba now contains an implementation of the Beam Radiance Estimate to accelerate Volumetric Photon Mapping within homogeneous participating media (scene courtesy of Wojciech Jarosz).

  • COLLADA: Previously, the import of very large scenes using COLLADA failed when the associated XML document contained text nodes that were larger than 10 megabytes. I submitted a patch to fix this in the COLLADA-DOM library, which was recently accepted. Mitsuba now ships with this version of the library.

  • Rotation Controller: several people commented that the interactive preview navigation was rather unintuitive. I have now added a rotation controller that will be more familiar to people using Maya or Blender. Dragging the mouse while pressing the left button rotates around a fixed point. The right mouse button & mouse wheel move along the viewing direction, and the middle mouse button pans. Press ‘F’ to zoom to the currently selected object and ‘A’ to focus on the whole scene. Note that the previous behavior can still be re-activated through the program preferences.

  • Miscellaneous: this release adds code to perform adaptive n-dimensional integration (based on the cubature project), as well as a chi-square test for verifying sampling methods. In the future, these will be used to implement an automatic self-test of all scattering models within Mitsuba.

    As always, the release also contains a plethora bugfixes, which won’t be listed in detail.