Multiple Importance
At work I wrote a global illumination system from scratch. It used classical ray tracing for the direct lighting, and photon mapping with final gather for the indirect term. I use the past tense since we’ve now switched over to using lightcuts as the main renderer, which due to the work of an awesome colleague, is giving us better results (and faster).
To complete the set, I thought I’d have a go at implementing a bidirectional path tracer, a “full Veach“, if you will…

The Cornell Box
The above image is from this little bidirectional path tracing experiment, using around 500 samples per pixel. I’m actually sick of staring at that damned box! I’ve been staring at it for years! This image shows a couple of interesting things:
- Don’t do all of your anti-aliasing in high dynamic range (see the light edge)
- Even in low dynamic range, a box filter doesn’t look that nice (see short box top edges)
If you want nicely anti-aliased results from HDR imagery, you probably want to render it two or three times as large as you need, then tone map it down to LDR, and then finally down-sample it to your target resolution. To generate the HDR pixels without so much aliasing in the first place, then something other than a box filter is required. If you’re interested in this sort of thing then the freely available Chapter 7 from PBRT will start you off. In fact I recommend reading the whole book, it’s very good.
Anyhow, what I wanted to post about was the awesome variance reduction power of multiple importance sampling. As covered in great detail in Eric Veach’s thesis, the basic idea is that you want to assign your path a weight, and this weight is computed by considering all possible ways that you could have generated your path, not just the one that you did use. An intuitive way to think about this is: consider the case that you generate a path, and for the way that you generated it (e.g. randomly hitting a light source) it seems fairly unlikely. If you consider this path purely in the way that you generated it, you end up with a very strong sample in your image. If by considering all other ways you could have generated the path you find that it is in fact very likely by other means (e.g. by connecting light and eye sub-paths), then this reduces the weight of your sample, which in turn reduces variance. By a lot. Here’s an example:

Unweighted Samples

Weighted Samples (Balance)
The amazing thing is that these images were generated using the exact same set of paths (just 4 paths per pixel), but then either summed with uniform weights or with weights computed using multiple importance sampling. The bright spots in the first image are mostly from eye sub-paths that randomly hit the light source. Multiple importance sampling assigns these paths a very low weight, which brings their sample value much closer to the expected value for the pixel, hence variance is much reduced. As Veach mentions, this processing is also basically free: you already know the visibility term between each vertex of your path, you just need to consider the probabilities for all the ways you could have constructed it.
There are lots of other awesome things you can learn from the Veach thesis, and since the work will be 12 years old this year, you probably should know this stuff by now, right?
Just discovered your blog.
Results look good! Seems like you would get similar results from just using path tracing with explicit light sampling. However if there was a specular surface somewhere then this would really help.
I hope to implement this some day. Your results are encouraging
Also, a very clear description. Thank you.
Kevin Beason
6 Feb 09 at 5:33 am
As a technique for rendering Cornell boxes, path tracing with explicit light sampling is not bad.
It just so happens that the one type of path this technique generates is common in the Cornell box scene, so doesn’t have crazy variance.
However, as you suggest, as soon as you start introducing different BRDFs, or even just strong indirect lighting, this one path type isn’t as strong as other path types, so you start to get much better results by generating paths bidirectionally.
Simon Brown
6 Feb 09 at 8:27 am
Great blog! There was some discussion about LDR vs HDR anti-aliasing over at ompf a while ago. Coming from a visual effects background, my instinct is always to preserve the dynamic range as long as possible, which means anti-aliasing in HDR.
I’ve never really been able to think of a way of getting a good result when looking directly at a lightsource. Of course, in reality, you would never look directly at a lightsource to begin with – this would result in glare and lens flares. The cornell box doesn’t have a 2D plane area light sitting at the top of it, so I think the aliasing problem is likely one of our own construction
Anders Langlands
6 Feb 09 at 10:04 am
Have you tried Resampled Importance Sampling by David Cline & Justin Talbot. Coupled with MIS it reduces the image variance by margins with half the required samples/pixel.
Joe Mwangi
9 Jun 10 at 9:51 am
Not tried. I’m not actually so familiar with that paper, but it seems to be related to drawing samples for BRDFs or light sources that have no well-matched distribution to use directly for IS. Since all IS in that scene is trivial (hemi-spherical emission, and Lambertian BRDF), what would I be resampling?
Simon Brown
9 Jun 10 at 12:58 pm
To be frank with you I was not really conversant with MIS in BDPT. After really reading it http://www.maw.dk/3d_graphics_projects/downloads/Bidirectional%20Path%20Tracing%202009.pdf together with veach thesis, I think I have a clear understanding of the importance of using MIS. I think RIS won’t be efficient in this area since it requires many pdf evaluation i.e large number of path length. To make it worthwhile to use it. I see no reason of using RIS. “What would I be resampling?” – The pdf’s of the path you could have likely generated, and reject the pdfs that give bad contribution.
Joe Mwangi
19 Jul 10 at 10:55 am