GithubHelp home page GithubHelp logo

Comments (2)

mmp avatar mmp commented on August 15, 2024

Hi, Brad--

I'm glad the book has been useful to you, and nice debugging there digging into this!

I think what is going on is related to pbrt's handling of shading normals (discussed here.) So a Lambertian BRDF for example always returns R/pi regardless of whether w_i and w_o are in the same hemisphere and reflection/transmission is selected in BSDF::f based on the geometric normal.

However, BSDF:Pdf doesn't do that and just evaluates the PDFs, which do return 0 (for example) for a Lambertian BRDF with w_i and w_o in different hemispheres.

So, I think those 0 PDF values are arising due to that. I think there may be an argument that it's all correct as written (but am not sure about that!). There is no chance of sampling those directions from BSDF sampling, yet the BSDF has a non-zero value. The light sample is still included, the MIS weight ends up being 1, and everything is ok 🤷 . Though I don't remember that as an intentional decision; my assumption looking at that code now (and presumably the assumption when it was written) was that f.IsBlack()==true <---> scatteringPdf==0, other than in rare floating-point edge cases.)

from pbrt-v3.

BradleyMarie avatar BradleyMarie commented on August 15, 2024

That explanation lines up with my own understanding of the behavior.

With the non-geometric nature of shading normals, the definition of correctness here is a bit pliable. In the limit case with an infinite number of samples for surfaces like this one the code as written will end up with a value somewhere between the value we’d get from just sampling the BRDF and just sampling the lights. If this in–between value has a useful interpretation, then I think it’s arguable that the value could be considered correct; however, my current feeling is that if a path returns light when it’s sampled by the light source then that same path should be samplable and light-yielding by the BxDF.

Another reason to consider treating the current behavior as incorrect is because the same issue repeats itself with indirect light paths. In this render I modified the Path integrator to ignore direct lighting on the first bounce, but to otherwise render the scene normally. Some of the same areas of darkness show up; however, in this case it feels more bug-like to me since if these areas also lack direct lighting then it means the final image can end up with dark spots in places where there geometrically should have been indirect lighting.

ecosys

I also glanced over the pbrt-v4 code and it looks like this particular issue involving indirect light no longer exists since BSDF::Sample_f uses the pdf returned from BxDF::Sample_f. That said, I think there may be a different issue for diffuse reflective paths where the pbrt-v4 code can instead sample and return light from transmissive paths since it does not seem to contain the pbrt-v3 logic which re-evaluates if a path is reflective or transmissive after it is sampled.

from pbrt-v3.

Related Issues (20)

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.