How do I calculate the BRDF (Bidirectional Reflectance Distribution Function)?

168 Views Asked by At

I've been attempting to calculate the BRDF to use in the second pass of a Photon Mapping program.

Below is the definition of BRDF according to Wikipedia.

$$ f_{r}(w_{i},w_{r}) = \frac{dL_{r}(w_{r})}{dE_{i}(w_{i})} $$

I've managed to calculate the irradiance $E_{i}$ by dividing the cumulative power of n nearest photons from a point X by the area $πr^2$, where r is the distance from the point X to the furthest photon in n nearest photons. This was a suggestion I read here.

I do not know how to calculate the radiance (or the numerator of the BRDF equation) however. I have access to the outgoing direction of the photon $w_r$, but I do not know how to apply it.