Importance sampling is proven to be very practical variance reduction technique since exact sampling routines can be found analytically for terms in the rendering equation most of the time. However, finding a single sampling routine for whole integrand analytically is not trivial. Therefore, it is important to combine various strategies focused on different terms.

For the integrand with indirect lighting, using more than one sampling strategy is not feasible since following more than one ray degrades performance due to recursive nature of the algorithm. For the integrand with direct lighting, however, different sampling strategies can be used since each sampled direction is tested against lights to understand if anything exists between the surface and lights. This intersection test procedure is costly but not recursive.

Two of the terms of the integrand cause most of the variance: bsdf and incoming radiance. If just one of them is used following cases might occur:

- If a direction is sampled according to bsdf of the material, ray with this direction may not hit light sources when light sources are too small.
- If a direction is sampled according to the lights, ray with this direction may not contribute to integrand when light source is too large and surface is rather smoother.

So, if strategies for these terms are combined with an unbiased approach instead of using just one of them, variance can be reduced further. Optimally Combining Sampling Techniques for Monte Carlo Rendering[VG95] presents different weighting heuristics to combine different sampling techniques. These weighting heuristics are used to prevent bias because different sampling strategies together might favor some directions more than other directions and this causes bias as those directions are selected more.

Glue uses multiple importance sampling, power heuristic with $\beta=2$, for direct lighting computations without an option to disable. However, the materials have a

**useMultipleImportanceSampling()**function which returns a boolean to guide the integrator about whether it is feasible to use multiple importance sampling or not. For example, this function returns "false" for diffuse materials because using multiple importance sampling is only a waste since samples of pdf based on bsdf are taken from all the hemisphere. However, in scenes illuminated by light probes (image based lighting), it returns "true" since the light source encapsulates the scene and the sample wouldn't be a waste. Of course, cases where most of the light probe is occluded are possible but at least variance related to cosine term can be reduced where most of the light probe is visible.
Relevant implementation is:

Following outputs clearly shows the effects of using multiple importance sampling. The scene contains four metal plates which are ordered such that the roughness of metals are increasing from top to bottom. Also, there are four sphere diffuse area light sources with the same exitant flux. Thanks to this famous test scene, we can see how sampling strategies, size of light sources and shape (controlled by roughness) of brdfs relate to each other when considering variance.

Case 1: Sampling according to bsdf of the material |

Case 2: Sampling according to the lights |

Multiple importance sampling with power heuristic |

## Comments

## Post a Comment