In our current implementation of a path tracer, we’ve assumed our geometry lives in a vaccuum. There’s nothing between surfaces, and nothing in the air would modify the irradiance as it travels through the vaccuum.
In reality this is not true: light passes through many mediums on Earth (water, smoke, the air itself) which affects its properties after passing through.
Example
God rays occur when the edges of clouds are thin/have low opacity, and the rays of light that shine through pick up particles in the air and bounce off of them and between them
Explosion clouds and fog are both considered volumes. One is simply more turbulent than the other. If we wanted to render the explosion accurately, we would need fluid sims
Scattering process
When interacting with a medium, four things can occur:
- Absorption: particles block light traveling towards the viewer.
- Emission: particles increase radiance when energy is converted into light.
- Out-scattering: particles cause the light to be deflected into different directions.
- In-scattering: radiance from other light rays is scattered into the current light path, increasing its radiance.
Coefficients
The phenomenon above are described by an absorption coefficient , which is the probability density that light will be absorbed per unit distance (1 meter), and a scattering coefficient , the probability that light is scattered per unit distance.
The extinction coefficient is simply the sum of the two. It’s the total loss in radiance per unit distance. Also called the attenuation coefficient.
If and vary throughout the space, then this is considered a heterogenous media (e.g. smoke). If both stay constant throughout a volume, then this is homogenous media (e.g. fog).
In practice we keep the coefficients constant depending on the medium properties, but scale it depending on the density of the given volume, which can vary for the same medium.
Beer-Lambert Law
Describes the ratio of incoming and outgoing light after it passes through a certain volume of medium. We have
where is the density of the given medium.
Determining the ray color after it passes through a medium
Integrating along the volume
Let be the final color of the ray. We want to take infinitesimal steps along the ray, e.g. raymarching. We have
where and are the color and density function at the current point described by , and is the accumulated transmittance over the ray march.
- Begin with and .
- Incrementally update and during the ray march, using the previous value and modifying it. See slides for exact formula.
In practice we convert the integral to a finite summation, with discrete values of instead of infinitesimal .
Accounting for light
This current formula doesn’t account for light sources in the scene. All it does is account for the medium the ray is traveling though.
To account for light, we perform nested ray marches. In particular, in addition to the ray march above, for each point , we ray march to a light source.
Phase functions
The previous method relies on a “color function” that doesn’t fully capture the possible mediums e.g. smoke, mist, cloud.
Phase functions are the “volumetric version” of BSDFs. They describe the fraction of light traveling along that is scattered along .
- Specified by the angle between and at a given point along .
- They are normalized and integrate to 1. Otherwise, radiance would not be conserved (not physically accurate). In a sense, phase functions describe the probability of scattering occurring in a particular direction.
- Just like BSDFs, phase functions are bidirectional: and can be swapped
- Can be isotropic or anisotropic, controlled by an asymmetry factor
Isotropic phase function
This is when , and is analogous to the Lambertian BRDF model. It is simply , because the surface area of a sphere is (and we begin with a unit sphere).
Henyey-Greenstein phase function
Actually uses the term. Commonly used in production rendering because it’s relatively inexpensive to calculate.