Chapter ThreeShapes

In this chapter, we will present pbrt’s abstraction for geometric primitives such as spheres and triangles. Careful abstraction of geometric shapes in a ray tracer is a key component of a clean system design, and shapes are the ideal candidate for an object-oriented approach. All geometric primitives implement a common interface, and the rest of the renderer can use this interface without needing any details about the underlying shape. This makes it possible to isolate the geometric and shading subsystems of pbrt. Without this isolation, adding new shapes to the system would be unnecessarily difficult and error prone.

pbrt hides details about its primitives behind a two-level abstraction. The Shape class provides access to ...

Get Level of Detail for 3D Graphics now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.