Monday, June 2, 2014

Subsurface Scattering!

So it's been quite a while since I've updated but I've been working on a ton of different features so there will be quite a lot of updates over a short period of time to make up for it. One of these features is subsurface scattering, which is when light enters an object, scatters around and then exits at a different location. This results in a very soft translucent appearance and is a necessary phenomenon to simulate if one wants to correctly render materials like marble, milk, skin, etc.

 My subsurface scattering implementation is a two-step process. In the first step, before rendering begins, the mesh is uniformly sampled an an irradiance calculation is performed at each sample. These samples are then stored in a hierarchical point cloud represented by an octree for fast lookup.

 The second step is the rendering pass. This step implements a BSSRDF (Bidirectional Surface Scattering Reflectance Distribution Function) which is the sum of two terms: a single scattering term and a multi-scattering term.

 The single scattering term is used for light that enters the material and then exits again after a single bounce. It is calculated by integrating the illumination over the length of the outgoing light ray and makes use of a phase function (in my case I use the Henyey-Greenstein function) to determine the degree to which the material is anisotropic (whether the light scatters mostly forward, backward or uniformly/isotropically).

 The multiple scattering term is used for light that bounces around inside the material many times before exiting. I use a diffuse dipole-light source approximation combined with the irradiance samples computed in the first step to simulate multiple scattering. One pole of the source is placed above the material and the other inside it - the distance determined by the material's properties.

Completely opaque statue rendered with a BRDF - No subsurface scattering here
Completely isotropic single-scattering term

Backwards anisotropic single-scattering term only with reduced extinction coefficient.

Diffuse multi-scattering term
Complete Combined Image

Mildly backward-scattering anisotropic version

Scattering and absorption terms cut by 4 each

Lit from behind to better show translucency

No comments:

Post a Comment