Lecture 13: Global Illumination and Path Tracing (95)

tanmayghai18

In reference to how I implemented Direct Lighting in Project 3-1 task 3, I was wondering how the accumulation of the light calculated here is correct. In particular, in "return L * p.brdf(wi, wo) * costheta / pdf", why is the pdf used for averaging only the costheta term?

woojinko

I think the note in the comments explains that while for the project, we need to loop over multiple lights and samples per light (accumulate them all and then average correctly), in this basic pseudocode they're simply sampling once out of all the lights. Dividing by pdf is not for averaging, but instead for the part of Monte Carlo Integration that weights the sample by probability to ensure it's an unbiased estimator.

In reference to how I implemented Direct Lighting in Project 3-1 task 3, I was wondering how the accumulation of the light calculated here is correct. In particular, in "return L * p.brdf(wi, wo) * costheta / pdf", why is the pdf used for averaging only the costheta term?

I think the note in the comments explains that while for the project, we need to loop over multiple lights and samples per light (accumulate them all and then average correctly), in this basic pseudocode they're simply sampling once out of all the lights. Dividing by pdf is not for averaging, but instead for the part of Monte Carlo Integration that weights the sample by probability to ensure it's an unbiased estimator.