diff options
author | Keuin <[email protected]> | 2022-04-14 19:04:12 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2022-04-14 19:04:12 +0800 |
commit | 25305140df28c19f622209bb514d290ad6e6486b (patch) | |
tree | 5e3bddf7def77ad2219c3e9506b40c30ac8e2476 /hitlist.h | |
parent | c9220aecd2c463c4ccfcec84a22fc2c0145db782 (diff) |
Fix shadow acne problem.
Diffstat (limited to 'hitlist.h')
-rw-r--r-- | hitlist.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -48,7 +48,14 @@ public: // Check the nearest object we hit for (const auto &obj: objects) { double t_; - if (obj->hit(r, t_, 0.0) && t_ < hit_t) { + // Fix the Shadow Acne problem + // Some diffused rays starts off from a point on the surface, + // while hit the surface very quickly at some small t like +-1e-10 or so. + // This decays the ray by accident, causing black pixels on the output image. + // We simply drop hits very near the surface + // (i.e. t is a very small positive number) to solve this problem. + static constexpr double t_min = 1e-8; + if (obj->hit(r, t_, t_min) && t_ < hit_t) { hit = true; hit_t = t_; hit_obj = obj; |