|
Monte Carlo Ray Tracing: BRDF Sampling Radiance at a point x in direction w' is given by: Where Li is the incoming ray direction ,n is the normal, and the BRDF is fr. To solve Kajiya's rendering equation and estimate the Radiance Lo at a point, we must integrate the radiance contribution of the solid angle dw over the entire hemisphere . For Monte Carlo Integration, we must thus generate random samples over the hemisphere by selecting an appropriate probability density function, and express the integral as a summation. I chose to work with the Phong BRDF (Lafortune, 1994) and to use importance sampling. I would have liked to use the Schlick BRDF, but was not clear on how to Importance Sample it (though rejection sampling would have worked). The phong BRDF is: Choosing a probability function For p1 (x), generate random direction on unit hemisphere proportional to cosine-weighted solid angle We generate 2 random numbers r1 and r2 in [0,1] and then transform them as follows:
This yields the integral for the diffuse part: For p2 (x), we generate random direction on unit hemisphere proportional to cosine lobe around the normal: The UML for the BRDF classes is shown below. Any BRDF model can be sampled by extending BRDFModel. The Sample() function generates a sample, and returns a pdf.Russian Roulette is used to decide between diffuse or specular reflectance and based on that <I1> or <I2> is evaluated.
|
||||||||||||||||||