Chapter 12. 3D Pipeline Overview
The advent of powerful consumer-level 3D accelerators has increased the expressive potential of games at the cost of higher development complexity. Graphics engines have evolved from simple sprite painting routines to real-time geometry processors; their complexity spiraling up to rival high-end CAD systems and military simulations.
In this new scenario, getting the graphics code right is probably the biggest challenge any development team will face. Developers must be able to create the illusion of immersion and reality at interactive frame rates. The complexity (and hence, the beauty) of the problem comes from the fact that each game poses new challenges and requires specific techniques. But some global coding ideas can be shared between most 3D games, making the design and coding of graphics subsystems feasible and cost-manageable.
We can imagine any 3D engine as a sequence of operations performed on incoming geometry, from the moment it's loaded from secondary storage to the moment part of it is displayed on screen. This process resembles a pipeline consisting of different segments: Geometry is pumped in through one end. Then, each pipe segment has a unique filter that is applied to the incoming stream (eliminating unseen data, illuminating it, and so on). After a number of stages, the surviving geometry exits through the opposite end of the pipeline, where it is displayed onscreen. It is thus common to refer to this process as the 3D graphics pipeline and to the data as the geometry stream.
This chapter provides a first look at the design and coding of 3D pipelines. We will analyze the global data structures and algorithms required to deliver the geometry stream to the 3D hardware efficiently. We will present a global pipeline framework, which we can use to build a wide range of simple games.
More elaborate titles will require using more advanced algorithms that deal with very specific problems: rendering organic geometry, indoor scenarios, and so on. We will explore those subjects in subsequent chapters. By using all this information combined, you should have a deep understanding of how commercial graphics engines are designed and coded.