424 10. The Rendering Engine
10.1.2.6. Materials
A material is a complete description of the visual properties of a mesh. This
includes a specifi cation of the textures that are mapped to its surface and also
various higher-level properties, such as which shader programs to use when
rendering the mesh, the input parameters to those shaders, and other parame-
ters that control the functionality of the graphics acceleration hardware itself.
While technically part of the surface properties description, vertex att ri-
butes are not considered to be part of the material. However, they come along
for the ride with the mesh, so a mesh-material pair contains all the informa-
tion we need to render the object. Mesh-material pairs are sometimes called
render packets, and the term “geometric primitive” is sometimes extended to
encompass mesh-material pairs as well.
A 3D model typically uses more than one material. For example, a mod-
el of a human would have separate materials for the hair, skin, eyes, teeth,
and various kinds of clothing. For this reason, a mesh is usually divided into
submeshes , each mapped to a single material. The Ogre3D rendering engine
implements this design via its Ogre::SubMesh class.
10.1.3. Lighting Basics
Lighting is at the heart of all CG rendering. Without good lighting, an other-
wise beautifully modeled scene will look fl at and artifi cial. Likewise, even the
Figure 10.19. A variation on the classic “Cornell box” scene illustrating how realistic lighting
can make even the simplest scene appear photorealistic.