8.4 Ray Tracing
So far we have treated visibility purely as a problem of positioning. Is a particular triangle in the view frustum and, if so, is there another triangle in front of it closer to the camera? We have temporarily left light out of the scene. There are no light sources and no shadows cast by objects nearer to the source than other objects. An approach to the whole visibility question that puts light back into the scene is called ray tracing. It turns out to be computationally intensive, but it has the ability to cope with some of the complex light interactions in a scene.
Light rays are an abstraction that helps turn the difficult physics of light into a approachable geometric problem. A light source sends light rays into the scene where they bounce off objects and, in some cases, end up entering the camera. Only those rays that are reflected into the camera finally determine the image. The computational difficulty is that the vast majority of rays do not enter the camera, so keeping track of them is irrelevant. The counterintuitive approach in ray tracing is to follow the rays backward, starting at the camera and moving into the scene. It is not physically realistic, but it keeps us from wasting computation on rays that end up reflected in a direction that completely misses the camera.
Tracing a ray from the camera to the scene means that it passes through the viewing window on the view plane. Points in the viewing window will get scaled appropriately to end up ...
Get Mathematical Structures for Computer Graphics now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.