# Phase functions#

This section contains a description of all implemented medium scattering models, which are also known as phase functions. These are very similar in principle to surface scattering models (or BSDFs), and essentially describe where light travels after hitting a particle within the medium. Currently, only the most commonly used models for smoke, fog, and other homogeneous media are implemented.

## Isotropic phase function (isotropic)#

This phase function simulates completely uniform scattering, where all directionality is lost after a single scattering interaction. It does not have any parameters.

```
<phase type="isotropic" />
```

```
'type': 'isotropic'
```

## Henyey-Greenstein phase function (hg)#

Parameter |
Type |
Description |
Flags |
---|---|---|---|

g |
float |
This parameter must be somewhere in the range -1 to 1
(but not equal to -1 or 1). It denotes the |
P, ∂, D |

This plugin implements the phase function model proposed by Henyey and Greenstein [HG41]. It is parameterizable from backward- (g<0) through isotropic- (g=0) to forward (g>0) scattering.

```
<phase type="hg">
<float name="g" value="0.1"/>
</phase>
```

```
'type': 'hg',
'g': 0.1
```

## SGGX phase function (sggx)#

Parameter |
Type |
Description |
Flags |
---|---|---|---|

S |
volume |
A volume containing the SGGX parameters. The phase function is parametrized by six values \(S_{xx}\), \(S_{yy}\), \(S_{zz}\), \(S_{xy}\), \(S_{xz}\) and \(S_{yz}\) (see below for their meaning). The parameters can either be specified as a constvolume with six values or as a gridvolume with six channels. |
P, ∂ |

This plugin implements the SGGX phase function [HDCD15]. The SGGX phase function is an anisotropic microflake phase function [JMA+10]. This phase function can be useful to model fibers or surface-like structures using volume rendering. The SGGX microflake distribution is parametrized by a symmetric, positive definite matrix \(S\). This positive definite matrix describes the geometry of a 3D ellipsoid. The microflake normals of the SGGX phase function correspond to normals of this ellipsoid.

Due to it’s symmetry, the matrix \(S\) is fully specified by providing the entries \(S_{xx}\), \(S_{yy}\), \(S_{zz}\), \(S_{xy}\), \(S_{xz}\) and \(S_{yz}\). It is the responsibility of the user to ensure that these parameters describe a valid positive definite matrix.

```
<phase type='sggx'>
<volume type="gridvolume" name="S">
<string name="filename" value="volume.vol"/>
</volume>
</phase>
```

```
'type': 'rayleigh',
'S': {
'type': 'gridvolume',
'filename': 'volume.vol'
}
```

## Lookup table phase function (tabphase)#

Parameter |
Type |
Description |
Flags |
---|---|---|---|

values |
string |
A comma-separated list of phase function values parametrized by the cosine of the scattering angle. |
P, ∂, D |

This plugin implements a generic phase function model for isotropic media parametrized by a lookup table giving values of the phase function as a function of the cosine of the scattering angle.

Notes

The scattering angle cosine is here defined as the dot product of the incoming and outgoing directions, where the incoming, resp. outgoing direction points

*toward*, resp.*outward*the interaction point.From this follows that \(\cos \theta = 1\) corresponds to forward scattering.

Lookup table points are regularly spaced between -1 and 1.

Phase function values are automatically normalized.

## Blended phase function (blendphase)#

Parameter |
Type |
Description |
Flags |
---|---|---|---|

weight |
float or texture |
A floating point value or texture with values between zero and one. The extreme values zero and one activate the first and second nested phase function respectively, and in-between values interpolate accordingly. (Default: 0.5) |
P, ∂ |

(Nested plugin) |
phase |
Two nested phase function instances that should be mixed according to the specified blending weight |
P, ∂ |

This plugin implements a *blend* phase function, which represents linear
combinations of two phase function instances. Any phase function in Mitsuba 3
(be it isotropic, anisotropic, micro-flake …) can be mixed with others in this
manner. This is of particular interest when mixing components in a participating
medium (*e.g.* accounting for the presence of aerosols in a Rayleigh-scattering
atmosphere).
The association of nested Phase plugins with the two positions in the
interpolation is based on the alphanumeric order of their identifiers.

```
<phase type="blendphase">
<float name="weight" value="0.5"/>
<phase name="phase_0" type="isotropic" />
<phase name="phase_1" type="hg">
<float name="g" value="0.2"/>
</phase>
</phase>
```

```
'type': 'blendphase',
'weight': 0.5,
'phase_0': {
'type': 'isotropic'
},
'phase_1': {
'type': 'hg',
'g': 0.2
}
```

## Rayleigh phase function (rayleigh)#

Scattering by particles that are much smaller than the wavelength
of light (e.g. individual molecules in the atmosphere) is well-approximated
by the Rayleigh phase function. This plugin implements an unpolarized
version of this scattering model (*i.e.* the effects of polarization are
ignored). This plugin is useful for simulating scattering in planetary
atmospheres.

This model has no parameters.

```
<phase type="rayleigh" />
```

```
'type': 'rayleigh'
```