https://smerity.com/montelight-cpp/
overview
stochastic ray tracing is one of the fundamental algorithms in computer graphics for generating photo-realistic images. we implement an unbiased monte carlo renderer as an experimental testbed 试验台 for evaluating improved sampling strategies. our results show that the improved sampling methods we use for rendering can give comparable image quality over twenty times faster than naive monte carlo methods.
approach
to simulate the global reflection of light throughout a scene, we need to consider how light moves around the scene. this is referred to as the light transport equation, described in Kajiya(1986). the basic idea is light is either produced by the object (emission) or reflected onto it from other objects (reflected). for full details, refer to our paper.
the integral for the reflected light is computed over the hemisphere of all possible incoming directions. as this is impossible to compute exactly, it is approximated using monte carlo methods. The primary issue that can occur is when noise is too strong to give reasonable estimations as to the radiance. Whilst the expected value remains accurate, the standard deviation (error) decreases by 1/√n, where nn is the number of samples. To achieve a noise free image requires a large number of samples, especially if the scene is complex.
Importance sampling using BRDF sampling
some materials only reflect light in very specific directions. this is commonly related to the roughness of the material. a mirror, such as the one on the left, needs far less samples than the diffuse surface on the right.
this is dictated 决定 by the material’s bidirectional reflectance distribution function (BRDF). this distribution function ditates how much light ends up reflected in a given direction. by sampling directions to test directly from this distribution function (importance sampling), we can avoid taking samples that contribute little to the final image.