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 Physically Based Rendering, 2nd Edition 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.