Week 8: RayMarching/Noise

Reading

Scratch Pixel

Book of Shaders

Domain Warping

Monday

Midterm project is finally posted. You have two weeks from today. I will post a demo video after class. Meet on slack for questions today.

Shadows

One of the advantages of path tracing methods over the triangle geometry pipeline is the ability to support global illumination models. While it is possible to do some shadows in the traditional pipeline, it is conceptually easier in the path tracing model.

First consider what it means conceptually for a point \(p\) to be in shadow. A point \(p\) is in shadow if …​

Now let’s consider how to compute if \(p\) is in shadow. What would we need to know as inputs? Can we express this as a ray marching problem?

Other paths to trace

The ray from the eye to the scene is the primary ray we are interested in as part of any ray tracer/ray marcher. We denote the direction of this ray as \(\hat{v}\) in the image below.

Ray examples

But using the same tracing technique, we can query other rays for added realism and additional effects. For the midterm you are asked to trace the shadow ray direction \(\hat{l}\). For mirror-like surfaces, you can trace a reflected ray \(\hat{r}\) which is the primary ray reflected about the surface normal at \(p\). Mixing the color seen by the reflected ray with the color of the primary ray can model partially to fully reflective surfaces.

For partially transparent surfaces, you can also model refraction or partial transmission of light through a surface by tracing the \(\hat{t}\) ray through the surface. This gets a bit tricky as you must traverse the SDF inside an object where the SDF is negative and you must use Snell’s law to determine how much the rays should bend when entering and leaving the transparent media. Snell’s law states that angles the incident and transmitted rays, \(\theta_1\) and \(\theta_2,\) make with the surface normal (or negation of the normal in the case of the transmitted ray) are related as follows:

\[\eta_1 \sin \theta_1 = \eta_2 \sin \theta_2\]

Scratch pixel has a good writeup of more of the details on refraction

Antialiasing