0
$\begingroup$

I've been implementing a path tracer, referring pbrt-v3. However, I'm a bit confused about its implementation. Code is here.

It seems when we sample to do transmission, it tests if it meets a total internal reflection, but it doesn't assign a proper value to the pdf, instead, after the function returns Vec3f(0,0,0) as BTDF value, it then tests if pdf is 0, if 0 then directly jumps out of the tracing loop.

I don't think this make sense since there should be radiance value if this ray continues to trace and does out of the specular object and hit a surface which is illuminated. But this implementation seems to leave out all such kind of radiance, and rely on the sample_f function to sample a reflection.

So how to properly compute the pdf of total internal reflection?

        // Account for the indirect subsurface scattering component
        Spectrum f = pi.bsdf->Sample_f(pi.wo, &wi, sampler.Get2D(), &pdf,
                                       BSDF_ALL, &flags);
        if (f.IsBlack() || pdf == 0) break;
$\endgroup$

1 Answer 1

1
$\begingroup$

The code does seem a bit ugly since it doesn't assign pdf and instead returns 0.

By returning 0 it's basically saying the same thing as pdf = 0 because f.IsBlack() returns true.

This is acceptable, it's basically saying the BSDF doesn't allow light go through at the given $w_o$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.