So this code is using a single ray to estimate indirect radiance but we could reduce variance by doing a for loop of rays?
I'm kind of confused by this. Is $f$ the same thing as $sample_f$ in project 3?
I think f stands for fresnel.
@dvernet The f in the code snippet is exactly BSDF::f in assignment 3. BSDF::sample_f in assignment 3 is roughly the combination of the two lines:
generate_direction_sample(isect.brdf, wo, &wi;, &pdf;);
Spectrum f = isect.brdf.f(wo,wi);
@ak-47 The code takes one possible path at a time. You can indeed reduce variance by taking more samples and a lot of commercial renderers do that. This is usually called branched path tracing.
For example in Cycles (Blender), the Progressive integrator simulates one path (or ray) per sample:
The Branched path integrator splits the ray, sampling multiple directions as well as multiple components of the material (e.g. glossy, diffuse, etc) in one sample:
This is in fact very useful when you want to reduce a specific type of noise. For example if you are getting noisy shadows on diffuse surfaces, you can get much better results by increasing only the amount of shadow rays for diffuse surfaces without having to up your camera rays.