mandyedi / raytracing-from-the-ground-up

This project aims to finish the source code examples of the book Ray Tracing from the Ground Up.
http://www.raytracegroundup.com
Other
22 stars 15 forks source link

Rethink the usage of epsilon in shadow hits #22

Open mandyedi opened 2 years ago

mandyedi commented 2 years ago

From the book, chapter 16.4 The Epsilon Factor "We could use a global constant for epsilon, but not all objects need the same value, and epsilon would have to be the largest value required for any object. This is about epsilon 0.001 for an axis-aligned box and for rendering transparent triangle meshes. However, a value this large can create rendering artifacts for other objects.
A better approach is to use a specific static class constant for each geometric object primitive, as this allows you to tailor its value for each object."

Research this approach (check pbrt), also check std::numeric_limits::epsilon's value.