Subsurface scattering

Hello everyone, and welcome to the final blog post of my advanced ray tracing course journey! In this project, I worked on implementing the subsurface scattering (SSS) algorithm described in Jensen’s 2001 paper titled “A Practical Model for Subsurface Light Transport.” [1] I must say that this has been one of the most challenging papers I have encountered so far, as it contains extensive mathematical theories on how to render translucent materials.

Dragon Scene rendered with Subsurface Scattering (SSS)

Introduction

Jensen's paper introduces a method for approximating subsurface scattering using a bidirectional surface scattering distribution function (BSSRDF). [1] Subsurface scattering is essential for rendering translucent materials realistically because many materials, like skin, are somewhat translucent in real life. Without this effect, objects may appear completely opaque and unnatural. Subsurface scattering models how light enters a surface, scatters inside the material (often multiple times), and exits at a different point, resulting in a softer and more realistic appearance.

The BSSRDF is an advanced version of the bidirectional reflectance distribution function (BRDF). While the BRDF assumes that light enters and exits the material at the same point, which working well for opaque surfaces, it produces a rigid and unrealistic appearance for translucent materials. In contrast, the BSSRDF models light entering at one point and exiting at another, making it suitable for simulating materials like marble, skin, and milk. By adjusting specific coefficients, we can replicate the unique visual characteristics of various materials.

Jensen's approximation breaks down subsurface scattering into two components:

  1. Single Scattering: Light enters the surface, scatters once, and then exits.
  1. Multiple Scattering: Light enters, scatters multiple times within the material, and exits at a different point.

Both components are necessary because relying solely on multiple scattering cannot adequately capture the effects of single scattering. Together, they create a realistic representation of how light interacts with translucent surfaces.

Below image is an example of the difference between the use of BRDF and BSSRDF.

(a) BRDF (b)BSSRDF (in 5 minutes) (c) BSSRDF a full Monte Carlo simulation (in 1250 minutes)

Theory

In this section, I will explain the mathematics behind the different terms and how they are applied in practice.

The realistic appearance of translucent materials, such as skin, marble, depends on two essential properties:

  1.  Reduced Scattering Coefficient (σs′): This coefficient describes how light scatters within the material, taking into account that scattering is not always perfectly random.
  2.  Absorption Coefficient (σa): This measures the amount of light that is absorbed by the material as it travels through it.

These properties are crucial for accurately simulating subsurface scattering. Different materials, for example, milk and marble, have unique values for σs′ and σa, which define how light interacts with them. You can see coefficient table below. 

Coefficient table for different materials

From these two coefficients, we can calculate the extinction coefficient (σt), which represents the total light attenuation, or how quickly light loses energy, within the material: σt=σs′+σa

The extinction coefficient is a crucial parameter in rendering translucent objects, as it determines how far light can travel before being scattered or absorbed. By using these values, we can recreate the subtle, glowing effects that make translucent materials appear lifelike.

Single Scattering


Single scattering occurs when light enters the material, scatters once, and exits the surface. This is modeled using Monte Carlo integration:


Single scattering

  1. When a ray intersects a translucent object, compute the entry point.
  2. Trace the refracted ray into the medium and randomly sample scattering distances using an exponential distribution: t=−log⁡(ξ)/σt(x)  where ξ is a random number between 0 and 1.
  3. Compute the attenuation and contribution of light exiting at the sampled point using the scattering equation.

Multiple Scattering


Multiple scattering involves light scattering many times inside the surface before exiting. The dipole approximation simplifies this by:


Multiple scattering

  1. Randomly sampling exit points on the object’s surface.
  2. Calculating the distance from the entry point to the real source and virtual source for each exit point: where dr and dv are distances to the real and virtual sources, respectively.



  3. Accumulating contributions from multiple exit points to approximate the final scattered light.


Results

David Scene with SSS 10000 single scattering samples,
 and 100 multiple scattering samples, rendered in 5min 14sec

Stanford Bunny Scene with SSS 2000 single scattering samples,
and 5000 multiple scattering samples, rendered in 3min 29 sec

Dragon Scene with SSS 100 single scattering samples,
and 100 multiple scattering samples, rendered in 74 sec

Comparsion BRDF with BSSRDF


Dragon Scene with BRDF

Dragon Scene with BSSRDF 


Standford Bunny Scene with BRDF


Stanford Bunny Scene with BSSRDF


David Scene with BRDF


David Scene with BSSRDF 



Final Notes

Working on subsurface scattering using Jensen’s BSSRDF model has been both challenging and rewarding journey. The paper itself is complex, and implementing its concepts proved to be just as demanding. By using marble coefficients in my scenes, I have achieved some promising results, although they do not yet fully match the quality demonstrated in the paper.

The scattering calculations have been particularly tricky, and I suspect there may be issues with division or weighting in my implementation that have caused noise in the output images. I plan to carefully review these calculations to ensure there are no errors, such as division by zero or incorrect weighting factors.

Despite these challenges, this project has significantly advanced my understanding of subsurface scattering. The results so far are encouraging, and I am excited to continue refining the implementation to capture the realistic translucency materials like skin or milk.


References

[1] Henrik Wann Jensen, Stephen R. Marschner, Marc Levoy, and Pat Hanrahan, 'A Practical Model for Subsurface Light Transport', 2001

Comments

Popular posts from this blog

Raven: The Beginning of My Ray Tracing Journey

Leveling Up Raven: BVH, Transformations, and Instancing