Page updated: May 21, 2021
Author: Curtis Mobley
View PDF

# The BRDF as a PDF

Equation (4) of The BRDF page,

 ${L}_{r}\left({𝜃}_{r},{\varphi }_{r}\right)={\int }_{2{\pi }_{i}}\phantom{\rule{0.3em}{0ex}}{L}_{i}\left({𝜃}_{i},{\varphi }_{i}\right)\phantom{\rule{0.3em}{0ex}}BRDF\left({𝜃}_{i},{\varphi }_{i},{𝜃}_{r},{\varphi }_{r}\right)\phantom{\rule{0.3em}{0ex}}cos{𝜃}_{i}\phantom{\rule{0.3em}{0ex}}d{\Omega }_{i}\phantom{\rule{0.3em}{0ex}},$

shows how the BRDF is used in the radiative transfer equation (e.g., in HydroLight), which is always working with radiances. In Monte Carlo simulations, you are tracking many individual rays as they interact with the medium and its boundary surfaces. In this case, the BRDF must be used as a probability distribution function (PDF) to determine the direction and weight of the reﬂected ray whenever a ray hits the boundary surface. This is a tricky business, and the step-by-step process is as follows.

### Computing the Reﬂected Ray Weight and Direction from a BRDF

Given: A ray with weight ${w}_{i}$ is incident onto the surface in direction $\left({𝜃}_{i},{\varphi }_{i}\right)$. The BRDF of the surface is known.

Needed: The weight ${w}_{r}$ and direction $\left({𝜃}_{r},{\varphi }_{r}\right)$ of the reﬂected ray.

Since the input direction $\left({𝜃}_{i},{\varphi }_{i}\right)$ is known, $BRDF\left({𝜃}_{i},{\varphi }_{i},{𝜃}_{r},{\varphi }_{r}\right)$ can be viewed as an (unnormalized) bivariate PDF for the reﬂected angles ${𝜃}_{r}$ and ${\varphi }_{r}$. Note that, in general, these angles are correlated. Proceed as follows:

1.
Compute the directional-hemispherical reﬂectance for the given $\left({𝜃}_{i},{\varphi }_{i}\right)$:

$\begin{array}{llll}\hfill {\rho }^{dh}\left({𝜃}_{i},{\varphi }_{i}\right)=& {\iint }_{2{\pi }_{i}}BRDF\left({𝜃}_{i},{\varphi }_{i},{𝜃}_{r},{\varphi }_{r}\right)\phantom{\rule{0.3em}{0ex}}cos{𝜃}_{r}\phantom{\rule{0.3em}{0ex}}d{\Omega }_{r}\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill =& {\int }_{0}^{2\pi }{\int }_{0}^{\pi ∕2}BRDF\left({𝜃}_{i},{\varphi }_{i},{𝜃}_{r},{\varphi }_{r}\right)\phantom{\rule{0.3em}{0ex}}cos{𝜃}_{r}\phantom{\rule{0.3em}{0ex}}sin{𝜃}_{r}\phantom{\rule{0.3em}{0ex}}d{𝜃}_{r}\phantom{\rule{0.3em}{0ex}}d{\varphi }_{r}\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.\phantom{\rule{2em}{0ex}}& \hfill \text{(1)}\end{array}$
2.
The reﬂected ray weight is then
 ${w}_{r}={\rho }^{dh}\left({𝜃}_{i},{\varphi }_{i}\right){w}_{i}\phantom{\rule{2.6108pt}{0ex}}.$ (2)
3.
Compute the cumulative distribution function (CDF) for ${\varphi }_{r}$ by
 $CD{F}_{\varphi }\left({\varphi }_{r}\right)=\frac{1}{{\rho }^{dh}\left({𝜃}_{i},{\varphi }_{i}\right)}{\int }_{0}^{{\varphi }_{r}}{\int }_{0}^{\pi ∕2}BRDF\left({𝜃}_{i},{\varphi }_{i},𝜃,\varphi \right)\phantom{\rule{0.3em}{0ex}}cos𝜃\phantom{\rule{0.3em}{0ex}}sin𝜃\phantom{\rule{0.3em}{0ex}}d𝜃\phantom{\rule{0.3em}{0ex}}d\varphi \phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$ (3)

Note that the directional-hemispherical reﬂectance is being used to convert the BRDF into a normalized bivariate PDF for ${𝜃}_{r}$ and ${\varphi }_{r}$. We are then “integrating out” the ${𝜃}_{r}$ dependence to leave a PDF for ${\varphi }_{r}$, which is then being used to construct the CDF for ${\varphi }_{r}$.

4.
Draw a random number $\Re$ from a uniform [0,1] distribution. Solve the equation
 $\Re =CD{F}_{\varphi }\left({\varphi }_{r}\right)$ (4)

for ${\varphi }_{r}$. This is the randomly determined azimuthal angle of the reﬂected ray.

5.
Compute the CDF for angle ${𝜃}_{r}$ from
 $CD{F}_{𝜃}\left({𝜃}_{r}\right)=\frac{{\int }_{0}^{{𝜃}_{r}}\phantom{\rule{0.3em}{0ex}}BRDF\left({𝜃}_{i},{\varphi }_{i},𝜃,{\varphi }_{r}\right)\phantom{\rule{0.3em}{0ex}}cos𝜃\phantom{\rule{0.3em}{0ex}}sin𝜃\phantom{\rule{0.3em}{0ex}}d𝜃}{{\int }_{0}^{\pi ∕2}\phantom{\rule{0.3em}{0ex}}BRDF\left({𝜃}_{i},{\varphi }_{i},𝜃,{\varphi }_{r}\right)\phantom{\rule{0.3em}{0ex}}cos𝜃\phantom{\rule{0.3em}{0ex}}sin𝜃\phantom{\rule{0.3em}{0ex}}d𝜃}\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$ (5)

Note that the angle ${\varphi }_{r}$ determined in step 4 is used in the BRDF in Eq. (5) when evaluating the $𝜃$ integrals. This is how the correlation between ${𝜃}_{r}$ and ${\varphi }_{r}$ is accounted for in the determination of the reﬂection angles.

6.
Draw a new random number $\Re$ from a uniform [0,1] distribution and solve the equation
 $\Re =CD{F}_{𝜃}\left({𝜃}_{r}\right)$ (6)

for ${𝜃}_{r}$. This is the randomly determined polar angle of the reﬂected ray. You can now send the new ray on its way.

For all but the simplest BRDFs, Eqs. (1) to (6) all must be evaluated numerically for each ray, which can be an enormous computer cost when billions of rays are being traced.

### A Simple Example

The Minnaert BRDF is

 $BRD{F}_{\text{Minn}}\left({𝜃}_{i},{\varphi }_{i},{𝜃}_{r},{\varphi }_{r}\right)=\frac{\rho }{\pi }{\left(cos{𝜃}_{i}\phantom{\rule{0.3em}{0ex}}cos{𝜃}_{r}\right)}^{k}\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$ (7)

[Comment: This BRDF was invented to explain the curious fact that the full moon appears almost uniformly bright from the center to the edge of the lunar disk. If the lunar dust were a Lambertian reﬂector, the full moon would appear bright at the center and darker at the edge. However, the Minnaert BRDF agrees with observation over only a limited range of angles.]

Note that for $k=0$ this reduces to the Lambertian BRDF. Equations (1) to (6) can be evaluated analytically for the Minnaert BRDF. Equation (1) evaluates to

 ${\rho }^{dh}=\frac{2\rho }{k+2}\phantom{\rule{0.3em}{0ex}}{cos}^{k}{𝜃}_{i}\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}},$

which reduces to ${\rho }^{dh}=\rho$ for a Lambertian surface. Equation (3) gives just

 $CD{F}_{\varphi }\left({\varphi }_{r}\right)=\frac{{\varphi }_{r}}{2\pi }\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$

Inserting this into Eq. (4) and solving for ${\varphi }_{r}$ gives

 ${\varphi }_{r}=2\pi \Re \phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$

Thus the azimuthal angle is uniformly distributed over 2$\pi$ radians. The CDF for ${𝜃}_{r}$ as given by (5) is

 $CD{F}_{𝜃}\left({𝜃}_{r}\right)=1-{cos}^{k+2}{𝜃}_{r}\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.$

Equation (6) then gives

 ${𝜃}_{r}={cos}^{-1}\left(\sqrt[k+2]{\Re }\right)\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}},$

after noting that $1-\Re$ has the same uniform distribution as $\Re$. For a Lambertian surface, the randomly generated ${𝜃}_{r}$ angles are distributed as ${cos}^{-1}\left(\sqrt{\Re }\right)$, which certainly is not intuitive. However, this distribution is precisely what is necessary to make the number of reﬂected rays per unit solid angle proportional to $cos{𝜃}_{r}$, as required for a Lambertian surface. See the additional discussion of this on the Lambertian BRDFs page.