Giter VIP home page Giter VIP logo

Comments (3)

linusmossberg avatar linusmossberg commented on June 3, 2024

Hi Wenxi!

ls.bsdf_pdf is passed to Interaction::sampleBSDF as reference in PathTracer::sampleRay, which then is passed to the second overloaded Interaction::BSDF as reference, where it is set to the true PDF of the importance sampled ray. So it is 0 when Integrator::sampleEmissive is called in the first iteration, but this is correct since the ray originated from the camera and not a surface scatter.

Integrator::sampleEmissive checks for this using interaction.ray.depth == 0, in which case MIS is not used since we couldn't have sampled a light source in the previous iteration using Integrator::sampleDirect (since there was no previous iteration).

Performing MIS this way is a bit confusing compared to trying both the light and BSDF sampling strategies at the same time when evaluating direct light like pbrt-v3, but it is more efficient since we don't have to cast an additional ray each iteration.

I think that pbrt-v4 has moved to this method as well judging by the following from the readme:

A single ray is now traced for both indirect lighting and BSDF-sampled direct-lighting.

I learned about this method from GLSL-PathTracer and possibly Tinsel if I recall correctly, so you may look at those as well.

from monte-carlo-ray-tracer.

wenxiwu777 avatar wenxiwu777 commented on June 3, 2024

Oh, I see, I may not get it previously. :)
I didn't notice the fact that at the time when the powerHeuristic is called the ls.bsdf_pdf is already assigned in the overloaded version of BSDF with six parameters, because if the ray hits the emissive surface in the first time the depth is 0 in that case the second condition won't be reached, but in the following paths the MIS between light source and material surface can be performed.

I haven't read pbrt-v4 code for now, I will learn it later as well as other resources you provided here.

Thank you for your reply.

from monte-carlo-ray-tracer.

linusmossberg avatar linusmossberg commented on June 3, 2024

Exactly!

from monte-carlo-ray-tracer.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.