3 ms·
This article is straight up bad. So, basic Whitted style ray tracer is, for each pixel, project a ray into the scene and see what the closest intersection is.
by jasonwatkinspdx 4y ago
This article is straight up bad.
So, basic Whitted style ray tracer is, for each pixel, project a ray into the scene and see what the closest intersection is. Now shoot secondary rays at each light source to see if the intersection is in shadow for that light, sum the lighting accordingly. Also if the material hit is shiny, shoot a ray out using snells law and recurse to see what it sees.
Now, with path tracing instead we approach the rendering problem more generally, and think of it as a 6D integral that describes all possible ways light can bounce in the scene. Then we sample this integral using monte carlo techniques. The most naive version of this would be to emit virtual photons from lights, trace where they go probabilistically using scattering equations at each surface interaction (so not just snells law) and then seeing if it ever blunders into the virtual camera.
Obviously that's very inefficient, so practical path tracers work backwards tracing paths from the camera, or bidirectionally doing both and seeing if they can connect. Then there's a huge pile of techniques like importance sampling that help make all this more efficient.
That said, at the end of the day, path tracing is much more computationally intensive than the classic ray tracer. However it's worth this because it can truly render all lighting in a physically correct way. Classic ray tracing bakes in assumptions about shadow rays and simple reflections, which is why images made with it have a very stark unrealistic appearance (think sphere and pyramid floating over a checkerboard style images).