These notes are the product of some fiddling earlier today on how to use BRDFs to do stochastic ray-tracing. I’m putting them up here as a Google target because I couldn’t find any similar treatments on the web. I hope they’re useful to someone!
The BRDF is the ratio of reflected radiance to incident irradiance at a particular wavelength. Radiance is a measure of energy (proportional to photon count for a particular wavelength) and irradiance is radiance scaled by projective area.
Letting represent the incident and reflected radiance, then the BRDF is given by:
where the incident irradiance is
From this we can find an estimate for the incident and reflected radiance contribution from a single direction:
For the moment, consider two PDFs over the incident and reflected directions:
The normalisation functions, are:
Suppose we wish to model light transport by sampling from or . For an eye ray, we with to estimate the total reflected radiance at a point:
We can re-express via and :
We can estimate this integral via importance sampling. That is to say if we draw from ,
where denotes the sample mean.
Now consider tracing a light ray. We interpret the ratio
as a relative likelihood of a ray incident at being reflected at . For a given incidence angle, is constant and we can therefore interpret as a PDF governing the ray transport.
Given an incident ray we sample an outgoing direction from and propagate the ray along it. We must however normalise the reflected radiance by the probability of having sampled that reflection direction. Specifically we multiply the incident luminance by the sample weight or
which, by definition, can be simplified to
We call this multiplicative factor the attenuation.
For a Lambertian diffuse BRDF, is constant and so . Thus, if we draw from , we have
Similarly, , therefore with uniform .
For a physically based BRDF, it must satisfy two conditions. Firstly it mus satisfy Helmholtz reciprocity:
Secondly, it must conserve energy:
For a Lambertian BRDF, this implies that .