Volume Rendering

Last Update:May 18, 2024 am

Volume rendering should consider not only the interaction between light and object surface, but also the interaction with a large number of particles in space. In this article, the general theory of volume rendering is introduced, and the ray propagation equation in the form of integral equation is derived. Finally, an example of real-time volume rendering is given.

Volume Media

The volume medium is composed of a large number of particles in the volume. When light propagates in the medium, there may be three situations: transmission, absorption and scattering.


Figure 1 - Interaction of Light Rays with Particles

At the same time, there may exist emission in the medium.

Absorption

Absorption is described by the absorption cross section of the medium, usually denoted as $\sigma_a$. Suppose that the light along $\boldsymbol{\omega}$ interacts with the medium at the point $\bf p$. Let $\sigma_a(\mathbf{p},\boldsymbol{\omega})$ be the ratio of the absorbed radiance to the original radiance after the light travels a unit length along the direction of $\boldsymbol{\omega}$ at the point $\bf p$, which can also be understood as the probability of light absorption. If the scattering of light in the medium is not considered, that is, the light always propagates along a straight line, then we can get the following formula about the radiance

Out-scattering

If the light traveling along the direction $\boldsymbol{\omega}$ is scattered to other directions at the point $\bf p$, we call this kind of scattering out-scattering. scattering coefficient represents the ratio of the emissivity scattered by the outside to the original emissivity after the light travels unit length in the direction of at the point $\bf p$. The out-scattering phenomenon is similar to the absorption phenomenon, which will lead to a decrease in the radiance emitted in the direction at the point $\bf p$, denoted by . The change rate of radiance caused by out-scattering can be described by the following formula

The combined effect of absorption and scattering is called attenuation or extinction. The attenuation coefficient $\sigma_{t}$ is defined as

The attenuation effect can be described by the following equation

There are two quantities associated with the attenuation coefficient that are also common. One is the albedo $\rho$, defined as

It represents the proportion of scattering effect to the attenuation effect. The other one is the mean free path $1/\sigma_t$, representing the average distance a photon travels along a straight line without being absorbed or scattered.

If only the attenuation effect is considered, then , which yields

Let $\mathbf{p}’=\mathbf{p}+h\boldsymbol{\omega}$, integrating from $\mathbf{p}$ to $\mathbf{p}’$ gives

which leads to

The term is called beam transmittance, representing the proportion of light rays in a beam that are not absorbed or scattered. has some commonly used properties. One is

and the other is

We often also assume

thus

In particular, if $\sigma_{\mathrm{t}}$ is constant, we have

This equation is called the Beer-Lambert law.

Emission

The radiance generated per unit length in the direction $\boldsymbol{\omega}$ at point $\mathbf{p}$ in a medium is given by $L_{\mathrm{e}}(\mathbf{p}, \omega)$. This can be written as

In-scattering

If light from other directions is scattered into the direction $\boldsymbol{\omega}$ at point $\mathbf{p}$, this scattering is called in-scattering.

We use the phase function $p(\mathbf{p}, \boldsymbol{\omega}_i, \boldsymbol{\omega}_o)$ to describe the distribution of scattering radiance in various directions, where $\mathbf{p}$ is the position of the point, $\boldsymbol{\omega}_i$ is the incident light direction, and $\boldsymbol{\omega}_o$ is the scattering light direction. By definition, the phase function must satisfy:

In-scattering increases the radiance in the direction $\boldsymbol{\omega}$ at point $\mathbf{p}$. Considering the radiance generated by medium emission, the total increase in radiance per unit length due to in-scattering and emission can be represented by

$L_{\mathrm{s}}(\mathbf{p}, \boldsymbol{\omega})$ is commonly referred to as the source term.

The Equation of Transfer

Differential-integral Equation Form

The radiance generated per unit length along the direction $\boldsymbol{\omega}$ at point $\mathbf{p}$ in the medium is given by $L_{\mathrm{e}}(\mathbf{p}, \omega)$, expressed as

In-scattering

If at point $\mathbf{p}$, light from other directions is scattered into the direction $\boldsymbol{\omega}$, this scattering is called in-scattering.

We use the phase function $p(\mathbf{p},\boldsymbol{\omega}_i,\boldsymbol{\omega}_o)$ to describe the distribution of scattering radiance in different directions, where $\mathbf{p}$ is the position of the point, $\boldsymbol{\omega}_i$ is the incident light direction, and $\boldsymbol{\omega}_o$ is the scattered light direction. By definition, the phase function must satisfy:

The in-scattering effect increases the radiance along the direction $\boldsymbol{\omega}$ at point $\mathbf{p}$. Considering the radiance generated by the medium’s emission, the total increase in radiance per unit length due to in-scattering and emission can be represented as

$L_{\mathrm{s}}(\mathbf{p},\boldsymbol{\omega})$ is usually called the source term.

The Equation of Transfer

Differential-integral Equation Form

Let $\mathbf{p}(t)=\mathbf{p}_0+t\boldsymbol{\omega}$, the rate of change of radiance in the direction $\boldsymbol{\omega}$ at point $\mathbf{p}(t)$ is determined by attenuation and the source term. The resulting equation is

which is

and is called the equation of transfer.

Integral Equation Form

To facilitate solving, the equation of transfer can be rewritten as an integral equation in terms of $L_{i}(\mathbf{p}(t),-\boldsymbol{\omega})$, given a boundary condition

Noting that , rearranging terms gives

multiplying both sides by

yields

which simplifies to

Integrating from $0$ to $t$ gives

which leads to

Noting that

multiplying both sides of the equation by and rearranging yields

Let $t’=t-s$, i.e., $s=t-t’$, substituting yields

Since $\mathbf{p}(t-t’)=\mathbf{p}_0+t\boldsymbol{\omega}-t’\boldsymbol{\omega}=\mathbf{p}(t)-t’\boldsymbol{\omega}$, further simplification yields

The equation

is called the integral form of the transfer equation. Let $\mathbf{p}’=\mathbf{p}-t’\boldsymbol{\omega}$, the transfer equation can also be written as


Figure 2 - Illustration of the Integral of Transport Equation

Real-time Volume Rendering

Phase Function

Assuming the phase function $p\left(\mathbf{p}^\prime, \boldsymbol{\omega}_i, \boldsymbol{\omega}\right)$ depends only on the angle $\theta$ between $\boldsymbol{\omega}_i$ and $\boldsymbol{\omega}$, i.e.,

The simplest phase function is

Physically-based phase functions depend on the particle size parameter $s_p$,

where $r$ is the particle radius, and $\lambda$ is the wavelength of light:

  • When $s_p\ll 1$, Rayleigh scattering occurs;

  • When $s_p\approx 1$, Mie scattering occurs;

  • When $s_p\gg 1$, geometric scattering occurs.

Rayleigh Scattering

The phase function for Rayleigh scattering is


Figure 3 - Polar Plot of the Rayleigh Scattering Phase Function

The scattering coefficient for Rayleigh scattering is inversely proportional to the fourth power of the wavelength:

Mie Scattering

The phase function for Mie scattering is given by the Henyey-Greenstein (HG) phase function:

where the parameter $g\in[-1,1]$. When $g>0$, forward scattering occurs; when $g<0$, backward scattering occurs; when $g=0$, isotropic scattering occurs.

The Schlick phase function:

is an approximation of the HG phase function and is computationally faster.


Figure 4 - Polar Plots of Henyey-Greenstein (Blue) and Schlick (Red) Phase Functions with $g$ values of 0, 0.3, 0.6

Source Term Estimation

Assuming there is no emission phenomenon in the medium, the scattering coefficient only depends on the position:

The source term can be approximated by:

where

is the visibility function, where represents the shadow map, and

represents the volume shadow. If $\sigma_t(\mathbf{p})$ is a constant $\sigma_t$, the expression for volume shadow is

where is the distance traveled by the ray in the volume from to .

The term in the source term estimation equation is the radiance of the $i$-th light, usually taken as:

or

where represents the radiance of the $i$-th light when .

Total Radiance Estimation

Assuming the attenuation coefficient $\sigma_\mathrm{t}$ only depends on position:

When $\mathbf{p}_1$ and $\mathbf{p}_2$ are close, we can use

as an estimate for

So,

can be estimated as

where

If $\sigma_t(\mathbf{p})$ is a constant $\sigma_t$, we have a more accurate estimate:

Instance

With a constant extinction coefficient $\sigma_t$ and an isotropic phase function, the formula for calculating the radiance is given by


Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless declaring additionally.