Book 1: For shadow acne, doesn't ignoring hits close to the intersection point lead to other problems? #1296
Unanswered
DeltaPavonis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Section 9.3 of Ray Tracing in One Weekend describes the fix to shadow acne as follows:
However, I believe that adopting this approach — changing the valid interval for hit-times from$(0, \infty)$ to $(0.001, \infty)$ — leads to a bigger problem.
ray_color(R)
. The function will callSphere::hit()
to find the minimum hit-time.t
=t
=ray_color
will recurse over and over again. The rays will keep bouncing off the inside surface of the sphere until this same error, once more, causes the ray to "warp" outside of the sphere and fly into the background.Summarizing, the problem here is that
(a) The correct intersection time is ignored because it is too close to 0; and
(b) The other intersection time happens to be positive, and happens to represent the ray's intersection with the interior of the object, causing a large number of recursive calls to occur.
So, my question is, shouldn't the code use the
front_face
variable to prevent shadow acne (by making sure that rays intersect the exterior of a surface if and only if they originated outside the surface, and analogously for surface interiors)? If the current method of tweaking the time interval has problems like this, why do we use it?(I am aware that Section 9.2 of Ray Tracing in One Weekend introduces the idea of bounding the recursion stack. While that would help for the specific issue I've mentioned, it wouldn't solve the root problem: that the wrong solution is being chosen because all solutions in$(0, 0.001)$ are discounted. However, as mentioned above, wouldn't just checking which surface the ray intersects at fix this root issue?)
If needed, I have found a specific input that causes the provided code to recurse more than$50,000$ times on a single call of $50,000$ times, before warping out again and flying into the background. I also have highly-detailed logs showing all calls of
ray_color
, that shows this exact behavior: A randomly-generated ray bounces between the two spheres before warping into the second sphere and bouncing off its inside surface more thanray_color
. If you would like to see them, feel free to ask!Beta Was this translation helpful? Give feedback.
All reactions