mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.91k stars 1.2k forks source link

Better focus ray search #123

Closed syoyo closed 7 years ago

syoyo commented 7 years ago

clang-format did some code reformat, but the core of change is here: https://github.com/mmp/pbrt-v3/compare/master...syoyo:better-focus-ray-search?expand=1#diff-2ca607d646ef4f24ea00346f9144205fL486

The situation can be reproduced in dragons.pbrt scene, by setting aperturediameter smaller and focusdistance shorter like this.

Camera "realistic"
        "string lensfile" "lenses/wide.22mm.dat"
        "float aperturediameter" 2
        "float focusdistance" .2

In this situation, it fails to find focus ray thus focusing takes too much time.

This PR tries to use different scaling factor for finding focus ray more quickly when aperturediameter is too small.

mmp commented 7 years ago

Thanks! Merged manually.

syoyo commented 7 years ago

Thank you!