11.2 Phase Functions

Just as there is a wide variety of BSDF models that describe scattering from surfaces, many phase functions have also been developed. These range from parameterized models (which can be used to fit a function with a small number of parameters to measured data) to analytic models that are based on deriving the scattered radiance distribution that results from particles with known shape and material (e.g., spherical water droplets).

In most naturally occurring media, the phase function is a 1D function of the angle theta between the two directions omega Subscript normal o and omega Subscript normal i ; these phase functions are often written as p left-parenthesis cosine theta right-parenthesis . Media with this type of phase function are called isotropic because their response to incident illumination is (locally) invariant under rotations. In addition to being normalized, an important property of naturally occurring phase functions is that they are reciprocal: the two directions can be interchanged and the phase function’s value remains unchanged. Note that isotropic phase functions are trivially reciprocal because cosine left-parenthesis negative theta right-parenthesis equals cosine left-parenthesis theta right-parenthesis .

In anisotropic media that consist of particles arranged in a coherent structure, the phase function can be a 4D function of the two directions, which satisfies a more involved kind of reciprocity relation. Examples of this are crystals or media made of coherently oriented fibers; the “Further Reading” discusses these types of media further.

In a slightly confusing overloading of terminology, phase functions themselves can be isotropic or anisotropic as well. Thus, we might have an anisotropic phase function in an isotropic medium. An isotropic phase function describes equal scattering in all directions and is thus independent of either of the two directions. Because phase functions are normalized, there is only one such function:

p left-parenthesis omega Subscript normal o Baseline comma omega Subscript normal i Baseline right-parenthesis equals StartFraction 1 Over 4 pi EndFraction period

The PhaseFunction abstract base class defines the interface for phase functions in pbrt.

<<Media Declarations>>= 
class PhaseFunction { public: <<PhaseFunction Interface>> 
virtual Float p(const Vector3f &wo, const Vector3f &wi) const = 0; virtual Float Sample_p(const Vector3f &wo, Vector3f *wi, const Point2f &u) const = 0;

The p() method returns the value of the phase function for the given pair of directions. As with BSDFs, pbrt uses the convention that the two directions both point away from the point where scattering occurs; this is a different convention from what is usually used in the scattering literature (Figure 11.11).

<<PhaseFunction Interface>>= 
virtual Float p(const Vector3f &wo, const Vector3f &wi) const = 0;

Figure 11.11: Phase functions in pbrt are implemented with the convention that both the incident direction and the outgoing direction point away from the point where scattering happens. This is the same convention that is used for BSDFs in pbrt but is different from the convention in the scattering literature, where the incident direction generally points toward the scattering point. The angle between the two directions is denoted by  theta .

A widely used phase function was developed by Henyey and Greenstein (1941). This phase function was specifically designed to be easy to fit to measured scattering data. A single parameter g (called the asymmetry parameter) controls the distribution of scattered light:

p Subscript normal upper H normal upper G Baseline left-parenthesis cosine theta right-parenthesis equals StartFraction 1 Over 4 pi EndFraction StartFraction 1 minus g squared Over left-parenthesis 1 plus g squared plus 2 g left-parenthesis cosine theta right-parenthesis right-parenthesis Superscript 3 slash 2 Baseline EndFraction period

The PhaseHG() function implements this computation.

<<Media Inline Functions>>= 
inline Float PhaseHG(Float cosTheta, Float g) { Float denom = 1 + g * g + 2 * g * cosTheta; return Inv4Pi * (1 - g * g) / (denom * std::sqrt(denom)); }

Figure 11.12 shows plots of the Henyey–Greenstein phase function with varying asymmetry parameters. The value of g for this model must be in the range left-parenthesis negative 1 comma 1 right-parenthesis . Negative values of g correspond to back-scattering, where light is mostly scattered back toward the incident direction, and positive values correspond to forward-scattering. The greater the magnitude of g , the more scattering occurs close to the omega Subscript or minus omega Subscript directions (for back-scattering and forward-scattering, respectively).

Figure 11.12: Plots of the Henyey–Greenstein Phase Function for Asymmetry g Parameters minus 0.35 and 0.67. Negative g values (solid line) describe phase functions that primarily scatter light back in the incident direction, and positive g values (dashed line) describe phase functions that primarily scatter light forward in the direction it was already traveling.

See Figure 11.13 to compare the visual effect of forward- and back-scattering.

Figure 11.13: Objects filled with participating media rendered with (left) strong backward scattering ( g equals negative 0.7 ) and (right) strong forward scattering ( g equals 0.7 ). Because the light source is behind the object with respect to the viewer, forward scattering leads to more light reaching the camera in this case.

HenyeyGreenstein provides a PhaseFunction implementation of the Henyey–Greenstein model.

<<HenyeyGreenstein Declarations>>= 
class HenyeyGreenstein : public PhaseFunction { public: <<HenyeyGreenstein Public Methods>> 
HenyeyGreenstein(Float g) : g(g) { } Float p(const Vector3f &wo, const Vector3f &wi) const; Float Sample_p(const Vector3f &wo, Vector3f *wi, const Point2f &sample) const;
private: const Float g; };

<<HenyeyGreenstein Public Methods>>= 
HenyeyGreenstein(Float g) : g(g) { }

<<HenyeyGreenstein Method Definitions>>= 
Float HenyeyGreenstein::p(const Vector3f &wo, const Vector3f &wi) const { return PhaseHG(Dot(wo, wi), g); }

The asymmetry parameter g in the Henyey–Greenstein model has a precise meaning. It is the average value of the product of the phase function being approximated and the cosine of the angle between omega prime Subscript and omega Subscript . Given an arbitrary phase function p , the value of g can be computed as

g equals integral Underscript script upper S squared Endscripts p left-parenthesis minus omega Subscript Baseline comma omega prime Subscript Baseline right-parenthesis left-parenthesis omega Subscript Baseline dot omega prime Subscript Baseline right-parenthesis normal d omega Subscript Baseline Superscript prime Baseline equals 2 pi integral Subscript 0 Superscript pi Baseline p left-parenthesis minus cosine theta right-parenthesis cosine theta sine theta normal d theta Subscript Baseline period

Thus, an isotropic phase function gives g equals 0 , as expected.

Any number of phase functions can satisfy this equation; the g value alone is not enough to uniquely describe a scattering distribution. Nevertheless, the convenience of being able to easily convert a complex scattering distribution into a simple parameterized model is often more important than this potential loss in accuracy.

More complex phase functions that aren’t described well with a single asymmetry parameter can often be modeled by a weighted sum of phase functions like Henyey–Greenstein, each with different parameter values:

p left-parenthesis omega Subscript Baseline comma omega prime Subscript Baseline right-parenthesis equals sigma-summation Underscript i equals 1 Overscript n Endscripts w Subscript i Baseline p Subscript i Baseline left-parenthesis omega Subscript Baseline right-arrow omega prime Subscript Baseline right-parenthesis comma

where the weights w Subscript i sum to one to maintain normalization. This generalization isn’t provided in pbrt but would be easy to add.