7. Color, Light, Materials, and ShadingIntroduction: From Geometry to AppearanceA geometric model describes the shape of an object, but geometry alone does not determine how that object appears. A sphere, for example, may be rendered as polished metal, rough clay, translucent plastic, or a glowing lamp. Its visible appearance depends on the interaction among illumination, material properties, viewing conditions, and the algorithms used to estimate reflected light. This chapter studies that interaction. Color and light are not merely visual decorations added after modeling. They are measurable physical and perceptual quantities that influence image formation, realism, visual communication, scientific visualization, games, simulation, and computer-aided design. A rendering system must therefore address several connected questions: How should color be represented? How much light reaches a surface? How does a material reflect, transmit, or absorb that light? How should the continuous illumination function be approximated over a polygonal model? The answers lead from color spaces and radiometry to reflectance models, light-source representations, normal mapping, interpolation methods, and physically based rendering. The chapter also emphasizes the assumptions behind common shading models. A technique may be computationally efficient yet visually inaccurate; another may be physically plausible but expensive or difficult to parameterize. Professional graphics programming is consequently an exercise in selecting an appropriate model rather than applying one universal formula. Learning ObjectivesAfter studying this chapter, students should be able to: 1. Distinguish color, radiometric, and photometric quantities and explain the purpose of common color spaces. 2. Describe how light interacts with surfaces through reflection, absorption, transmission, and emission. 3. Explain reflectance, the BRDF, and the rendering equation at a conceptual and mathematical level. 4. Compare point, directional, area, environment, and emissive light sources. 5. Analyze material models, including diffuse, specular, dielectric, metallic, and physically based models. 6. Explain normal mapping, tangent spaces, and the distinction between geometric and shading normals. 7. Compare flat, Gouraud, Phong, and physically based shading in terms of quality, cost, and artifacts. 8. Choose suitable color, lighting, material, and shading strategies for practical rendering systems. Color as Representation and PerceptionA color model specifies how numerical values describe color. The RGB model represents a color using red, green, and blue components and is convenient for displays because most displays emit light through three primary channels. RGB, however, is device-dependent: the same numerical triplet can produce different colors on different displays unless the primaries, white point, and transfer function are specified. The CIE XYZ system provides a device-independent tristimulus representation based on human color matching experiments. It is not usually used directly for artistic manipulation, but it provides a reference from which other spaces are derived. CIE xy chromaticity coordinates separate chromaticity from luminance, although they do not preserve perceptual uniformity. HSV and HSL reorganize RGB into hue, saturation, and value or lightness. They are useful in user interfaces because they correspond approximately to intuitive controls, but they are not physically meaningful and are not perceptually uniform. A small numerical change in one region may produce a larger perceived change than the same change elsewhere. Spaces such as CIELAB and CIELUV attempt to make equal numerical distances correspond more closely to equal perceived differences. Modern systems also use perceptual spaces such as OKLab for color adjustment and grading. In rendering pipelines, linear RGB is particularly important. Sensor or display-oriented RGB values are commonly encoded with a nonlinear transfer function, such as sRGB encoding. Lighting calculations must generally be performed in linear-light space; adding or multiplying gamma-encoded values produces incorrect energy relationships. For example, if two light contributions are added, their linear intensities should be added before conversion to a display encoding. The usual workflow is therefore: decode texture colors into linear values, perform lighting and blending in linear space, apply exposure and tone mapping, and encode the final image for display. Confusing encoded values with linear intensities is a common source of dark or overly bright results. High-dynamic-range rendering stores values greater than the display range, allowing bright lamps, sunlight, and reflections to coexist with darker regions. Tone mapping compresses this range for display. Exposure adjustment, white balance, contrast, and gamut mapping are not substitutes for correct illumination; they are stages that adapt a physically or numerically broad signal to a viewing device. Radiometry and PhotometryRadiometry measures electromagnetic radiation in physical energy terms. The central quantities are radiant energy, radiant flux, irradiance, radiance, and intensity. Radiant flux is power, measured in watts. Irradiance is radiant power arriving per unit surface area, while radiant exitance is power leaving a surface per unit area. Radiance describes power traveling through a projected area and solid angle. It is especially important in rendering because, in ideal vacuum transport, radiance remains constant along a ray. Radiant intensity describes power emitted per unit solid angle by a source. These quantities should not be confused with photometric quantities, which weight radiation according to the average human visual response. Luminous flux is measured in lumens, illuminance in lux, and luminous intensity in candelas. Photometry is appropriate when the goal is visual appearance under human vision; radiometry is required when energy conservation, sensors, thermal effects, or non-visible wavelengths matter. The cosine law is fundamental. A surface receives less irradiance when light arrives obliquely because the effective projected area is smaller. For a differential surface and a distant directional light, the contribution is proportional to max(0, n·l), where n is the surface normal and l points toward the light. This term is present in the Lambertian model and in more advanced models. Surface Interaction and the Rendering EquationWhen light reaches a surface, some energy may be absorbed, reflected, transmitted, or emitted. The proportions depend on wavelength, direction, material composition, surface microstructure, and, in some cases, wavelength-dependent scattering within the material. A surface can therefore exhibit both color-selective absorption and direction-selective reflection. The bidirectional reflectance distribution function, or BRDF, describes how much incident light arriving from direction l is reflected toward viewing direction v. It is written conceptually as f_r(l,v) = dL_o(v) / dE_i(l), where dL_o is outgoing radiance and dE_i is incident irradiance from a differential direction. A BRDF is bidirectional because it depends on both incoming and outgoing directions. It is not itself a color value; it describes directional reflection, often separately or jointly across wavelengths. A physically plausible BRDF generally satisfies non-negativity, reciprocity under appropriate conditions, and energy conservation. Non-negativity means it cannot reflect negative energy. Reciprocity states, approximately, that exchanging incoming and outgoing directions produces the same response for a reciprocal material. Energy conservation requires that the total reflected energy not exceed the incident energy. The rendering equation expresses outgoing radiance as emitted radiance plus reflected incoming radiance: L_o(x,v) = L_e(x,v) + integral over the hemisphere of f_r(x,l,v)L_i(x,l)(n·l) dω_l. The equation is conceptually simple but computationally difficult because incoming radiance may itself result from reflections, refractions, shadows, and multiple bounces. Real-time renderers approximate the equation using direct lighting, image-based lighting, precomputed data, shadow maps, screen-space methods, or hybrid ray tracing. Offline renderers may use path tracing, bidirectional methods, photon techniques, or other Monte Carlo estimators. Light Sources and Illumination ModelsA point light is modeled as emitting from a single position. It is computationally convenient and produces hard geometric shadows unless softened by filtering or additional sampling. Its intensity often decreases with the inverse square of distance, although artistic engines sometimes use modified attenuation for controllability. Applying inverse-square attenuation consistently is important when physical units and predictable scale are desired. A directional light represents a source sufficiently distant that all rays are parallel. Sunlight is commonly approximated this way. Directional lights have no positional falloff within the scene, but their angular size must be considered if soft solar shadows are required. An area light has finite spatial extent. It produces soft shadows because a surface point sees different portions of the source with different visibility. Area lights are more realistic than point lights but require integration or sampling. Large sources generally produce softer penumbras than small sources at the same distance. Environment lighting represents illumination arriving from all directions, often from a high-dynamic-range panoramic image or an analytical sky model. It provides plausible ambient reflections and can illuminate objects without explicitly placing many local lights. Image-based lighting is especially important for metals, whose appearance is strongly determined by reflected surroundings. An emissive material can serve as a visible light source in a path tracer. In a basic rasterization pipeline, making a surface bright does not automatically illuminate other objects; light transport must be computed separately. This distinction between visible emission and actual illumination is a frequent implementation error. Material Models: From Idealized Surfaces to MicrofacetsThe Lambertian model assumes perfectly diffuse reflection. Its BRDF is constant with respect to direction and is commonly represented as albedo divided by pi. Lambertian surfaces appear equally bright from different viewing directions under uniform illumination, although their irradiance still depends on the surface orientation. Specular reflection is directional. A perfectly smooth mirror reflects light in one precise direction, whereas a rough surface distributes reflection around that direction. The Phong model approximates this distribution using a powered cosine term around the reflection vector. Blinn–Phong uses the halfway vector between light and view directions and is often more convenient for real-time computation. These models are useful, inexpensive, and intuitive, but their parameters do not always correspond consistently to measurable material properties. Physically based shading commonly uses a microfacet model. The surface is treated as a collection of microscopic planar facets. The model typically contains three terms: a normal distribution function D describing the statistical orientation of facets, a geometry or masking-shadowing term G describing visibility of facets, and a Fresnel term F describing the proportion of light reflected at an interface. A common form is f_spec = DFG / [4(n·l)(n·v)]. The exact distribution may be GGX, Beckmann, or another choice. GGX is widely used because it produces a long-tailed highlight that often resembles real rough surfaces. Roughness controls the spread of the reflection, while the normal distribution and geometry term ensure more plausible behavior than an unconstrained Phong exponent. The Fresnel effect states that reflectance generally increases at grazing angles. Dielectrics such as plastic, wood, and ceramic have a low reflectance at normal incidence and become more reflective near the edge of a surface. Metals reflect strongly at normal incidence and often tint the reflected light according to their complex optical properties. This leads to a central practical distinction: in a simplified metallic-roughness workflow, nonmetals use a colored diffuse component and near-neutral specular reflectance, whereas metals use the base color primarily to tint specular reflection and have little or no diffuse response. A physically based material workflow does not guarantee physical truth. Artists may still use authored values, simplified lighting, or texture maps that do not correspond to measured data. Its value lies in providing parameters with more stable meaning across lighting conditions and assets. Normals, Tangent Spaces, and Normal MappingA normal determines how a shading model interprets a surface orientation. A geometric normal is derived from the actual triangle geometry. A vertex normal may be averaged across adjacent faces to create a smooth appearance. A shading normal is the normal supplied to the lighting calculation and may be interpolated or modified. Normal mapping stores orientation perturbations in a texture rather than increasing geometric complexity. A tangent-space normal is usually encoded relative to the tangent, bitangent, and geometric normal at a surface point. The tangent-space vector is transformed into world or view space before lighting. Correct construction of the tangent frame is essential; inconsistent tangent conventions can cause seams, inverted relief, or lighting that changes with mesh transformations. A normal map does not change the silhouette or occlusion of an object. It changes local shading only. It is therefore effective for bricks, scratches, pores, and fine grooves but cannot replace geometry for a deep hole visible in profile. A height or displacement map can alter geometry, but displacement introduces additional requirements for tessellation, continuity, and self-occlusion. Normal maps are commonly stored in a nonlinear-looking color format even though their components represent signed vector coordinates. They must not be treated as ordinary color textures with color correction. The normal must be decoded, remapped from [0,1] to approximately [-1,1], normalized, and transformed using the tangent frame. Four Shading ApproachesFlat ShadingFlat shading uses one normal, often one face normal, for an entire polygon. Adjacent polygons can therefore appear visibly distinct. This is appropriate for intentionally faceted objects, low-polygon art, diagnostic visualization, and some scientific or engineering displays. Its principal advantage is simplicity and faithful representation of polygonal segmentation. Its limitation is discontinuity at edges that should appear smooth. Gouraud ShadingGouraud shading calculates lighting at vertices and interpolates the resulting colors across the polygon. It is considerably smoother than flat shading at low cost, but it can miss a small specular highlight that lies between vertices. The result is especially problematic for large triangles, rapidly varying illumination, or narrow highlights. Gouraud shading also interpolates colors rather than recomputing the lighting equation at each fragment. Phong ShadingPhong shading interpolates vertex normals across the polygon and evaluates the lighting model per fragment. It generally produces smoother diffuse transitions and captures highlights that Gouraud shading may miss. It does not mean that the Phong reflection model must be used; “Phong shading” refers primarily to per-fragment interpolation of normals, whereas “Phong illumination” refers to a particular specular model. This distinction is important when comparing rendering systems. Interpolated normals need normalization after interpolation because linear interpolation does not preserve unit length. Failure to renormalize causes lighting errors, particularly across large triangles or under nonuniform transformations. Normals should also be transformed with the inverse transpose of the model transformation when the transformation includes nonuniform scaling. Physically Based ShadingPhysically based shading evaluates a material model designed around energy conservation, Fresnel behavior, microfacet distributions, and consistent parameterization. It can be combined with rasterization or ray tracing. It does not eliminate the need for good geometry, textures, lighting, color management, or artistic judgment. Its principal advantage is predictable appearance under different environments; its costs include more parameters, greater implementation complexity, and sensitivity to invalid asset data. A Practical Rendering WorkflowA robust workflow begins by defining units, coordinate conventions, color primaries, white point, and whether texture values are encoded or linear. Geometry is then assigned material parameters such as base color, metallic value, roughness, normal, and emission. Lighting is selected according to the intended environment: local analytic lights for control, environment maps for contextual illumination, or sampled area lights for soft shadows. The renderer transforms positions and normals into a consistent space, evaluates visibility, computes direct and indirect contributions, and accumulates results in linear HDR form. It then applies exposure, tone mapping, color grading where appropriate, and display encoding. Diagnostic views—normal direction, roughness, metallic value, albedo, shadow factor, and luminance—are indispensable when an asset appears incorrect. For real-time applications, the choice is constrained by frame time, memory bandwidth, shader complexity, and platform capability. Deferred shading can evaluate many lights efficiently by storing surface attributes in buffers, while forward or clustered forward approaches may be preferable for transparency and mobile hardware. Ray tracing can improve shadows, reflections, and global illumination, but denoising and sampling strategies remain necessary. Illustrative Case Study: Real-Time Visualization of a Mechanical AssemblyBackgroundA university engineering laboratory develops an interactive application for inspecting a mechanical pump. The model contains machined metal, painted steel, rubber seals, transparent inspection windows, and small engraved markings. The application must run at interactive frame rates while allowing users to rotate the pump under studio lighting. ProblemThe first prototype uses vertex colors, point lights, and a Phong exponent selected independently for each object. Under one camera angle the pump appears plausible, but highlights disappear when the model rotates, painted surfaces look metallic, and the transparent window becomes an opaque gray. Fine grooves are represented by dense geometry, causing memory and performance problems. AnalysisThe appearance errors have several causes. Vertex-based lighting misses narrow highlights. The material parameters are not physically interpretable, so the painted steel and bare steel respond similarly. The lighting is not calibrated, and color values are blended in an encoded display space. The grooves need local shading detail but not necessarily silhouette changes. Finally, transparency requires a transmission model and an appropriate rendering strategy rather than simply reducing opacity. ApproachThe team adopts a linear HDR pipeline and a metallic-roughness material representation. Bare steel receives a metallic value near one, while paint and rubber are treated as dielectrics with distinct roughness values. A normal map represents shallow machining marks and engraved detail; deeper cuts remain geometric. Studio area lights and an environment map provide broad reflections, while shadowing is computed with a hybrid raster and ray-traced method on capable hardware. Normals are transformed correctly, tangent frames are generated consistently, and per-fragment microfacet shading is used. The inspection window receives a transmission material with index-of-refraction parameters and is rendered in a transparent pass with sorting or ray-based refraction as supported by the platform. Diagnostic buffers are used to validate roughness, metallic, and normal textures. OutcomeHighlights remain visible during rotation, metal and paint are distinguishable, and the model requires substantially less geometry for fine surface detail. The application achieves its target frame rate on high-end systems and offers a reduced-quality fallback using rasterized reflections and simpler shadow maps. Learning PointsThe case demonstrates that realism is not produced by a single sophisticated shader. It emerges from coordinated color management, coherent material parameters, appropriate light-source models, correct normal handling, and a rendering strategy matched to performance requirements. It also illustrates the importance of separating geometric detail from shading detail and of validating assets through measurable diagnostic views. Limitations, Risks, and Professional ConsiderationsNo shading model reproduces every material. Simplified models may fail for hair, cloth, layered coatings, anisotropic brushed metals, subsurface scattering, iridescence, and participating media. Even physically based BRDFs can produce errors when the light field is incomplete or when texture data is inconsistent. Common mistakes include performing lighting in gamma-encoded space, using an unnormalized interpolated normal, applying a normal map in the wrong tangent basis, treating emission as illumination in a rasterizer, using metallic values to represent arbitrary darkness, and mixing units among lights, geometry, and camera exposure. Another mistake is increasing polygon count to solve a problem that belongs in a normal or roughness map. The visual quality of a renderer can also affect professional and ethical decisions. In medical, scientific, architectural, and engineering visualization, misleading color scales or exaggerated contrast may cause incorrect interpretation. Color choices should consider color-vision deficiencies, display variation, and the difference between perceptual emphasis and quantitative meaning. Asset pipelines should document color spaces, units, texture provenance, and parameter conventions to support reproducibility. Contemporary DirectionsReal-time ray tracing is increasingly used for reflections, shadows, and global illumination, while rasterization remains essential for predictable performance. Neural denoising and learned sampling can reduce the cost of noisy Monte Carlo estimates, although they may introduce temporal artifacts or hallucinated detail. Neural radiance fields and related scene-representation methods offer alternative approaches to view synthesis, but their material editability and generalization remain active research topics. Spectral rendering models wavelength-dependent transport more explicitly than RGB rendering and can improve the treatment of dispersion, fluorescence, and accurate color matching. Differentiable rendering enables optimization of geometry, materials, lighting, and camera parameters from images, supporting inverse graphics and computer vision. These developments do not replace foundational concepts: any advanced renderer still depends on sound definitions of radiance, reflectance, color, visibility, and sampling. Best Practices for Rendering SystemsA professional implementation should: - Keep lighting calculations in linear space and maintain an explicit display-encoding stage.
- Use consistent units, coordinate systems, handedness, and normal transformations.
- Prefer material parameters with stable interpretations across assets and lighting environments.
- Validate BRDF implementations for non-negativity, energy conservation, and grazing-angle behavior.
- Normalize interpolated normals and verify tangent-space conventions for normal maps.
- Use area or environment lights when soft shadows and realistic reflections matter.
- Separate geometric detail, normal detail, roughness variation, and color information according to their visual roles.
- Provide diagnostic visualizations and test scenes rather than judging shaders only in a single artistic environment.
- Match rendering quality to application constraints, with documented fallbacks for weaker hardware.
Chapter SummaryAppearance in computer graphics results from the interaction of color representation, illumination, material response, geometry, and numerical approximation. RGB is convenient but device-dependent, while linear-light processing is essential for correct lighting calculations. Radiometry describes physical energy, whereas photometry weights energy by human visual sensitivity. The BRDF characterizes directional reflection, and the rendering equation combines emitted and reflected radiance. Point, directional, area, environment, and emissive sources provide different compromises between control, realism, and computational cost. Lambertian, Phong, Blinn–Phong, and microfacet models represent increasing levels of material realism. Physically based shading incorporates Fresnel reflection, microfacet distributions, geometry terms, and energy-conscious parameterization. Normal mapping adds local shading detail without changing silhouette, but requires correct tangent-space handling. Flat shading preserves facets; Gouraud shading interpolates vertex-lit colors; Phong shading interpolates normals and computes lighting per fragment; physically based shading uses more plausible material and reflection models. Effective rendering practice combines these ideas with color management, diagnostics, performance planning, and awareness of the limitations of every approximation. Key TermsColor space: A defined coordinate system for representing colors. Linear RGB: RGB values proportional to light intensity and suitable for lighting calculations. Radiometry: Measurement of electromagnetic radiation in physical energy units. Photometry: Measurement of radiation weighted by human visual sensitivity. Radiance: Directional radiant power per projected area and solid angle. Irradiance: Radiant power arriving per unit surface area. BRDF: Function describing directional reflection from incident to outgoing directions. Rendering equation: Integral equation expressing outgoing radiance as emission plus reflected incoming radiance. Albedo: A surface reflectance or base-color parameter, often used for diffuse response. Fresnel effect: Angle-dependent change in the proportion of light reflected at an interface. Microfacet model: Surface model representing reflection from many microscopic facets. Roughness: Parameter describing the spread of a surface’s specular reflection. Metallic parameter: Simplified material control distinguishing metallic from dielectric behavior. Normal mapping: Technique that perturbs shading normals using a texture. Tangent space: Local coordinate frame formed by tangent, bitangent, and normal vectors. Flat shading: Shading method using a constant face normal across a polygon. Gouraud shading: Method that computes lighting at vertices and interpolates colors. Phong shading: Method that interpolates normals and evaluates lighting per fragment. Tone mapping: Transform that compresses HDR values into a displayable range. Energy conservation: Requirement that reflected and transmitted energy not exceed incident energy. Review QuestionsShort Answer Questions1. Why must lighting calculations generally be performed in linear RGB rather than display-encoded RGB? 2. Distinguish radiance from irradiance. 3. What information does a BRDF provide? 4. Why does a normal map not alter an object’s silhouette? 5. State one important difference between Gouraud and Phong shading. Long Answer Questions1. Explain the rendering equation and discuss why its direct numerical evaluation is difficult. 2. Compare Lambertian, Phong, Blinn–Phong, and microfacet material models. 3. Describe point, directional, area, and environment lights, including their visual and computational characteristics. 4. Explain the metallic-roughness workflow and the role of Fresnel reflection. 5. Discuss the complete color-managed workflow from texture input to display output. Analytical / Application Questions1. A rendered metal object appears uniformly gray and its reflections do not change as the camera moves. Diagnose the likely lighting and material problems and propose corrections. 2. A large triangular mesh shows a disappearing highlight when rendered with Gouraud shading but not with Phong shading. Explain the cause and recommend a solution under both high-performance and high-quality constraints. 3. Design a shading strategy for a real-time architectural viewer containing painted walls, glass windows, brushed metal, and small surface imperfections. Justify the color, lighting, material, normal-mapping, and performance choices. 22. Multiple Choice Questions with AnswersQuestion 1Why should lighting operations generally be performed in linear RGB space? A. Linear RGB requires no color primaries B. Linear RGB values are proportional to light intensity C. Linear RGB automatically produces wider-gamut colors D. Linear RGB eliminates the need for tone mapping Correct Answer: B. Linear RGB values are proportional to light intensity Question 2Which quantity measures radiant power arriving per unit surface area? A. Radiance B. Radiant intensity C. Irradiance D. Luminous flux Correct Answer: C. Irradiance Question 3What does a BRDF primarily describe? A. The geometric silhouette of an object B. The directional distribution of reflected light C. The number of polygons in a mesh D. The display encoding of a texture Correct Answer: B. The directional distribution of reflected light Question 4A renderer uses vertex lighting and interpolates colors across each triangle. Which method is being used? A. Flat shading B. Gouraud shading C. Phong shading D. Path tracing Correct Answer: B. Gouraud shading Question 5Why can Gouraud shading miss a small specular highlight? A. It does not use surface normals B. It evaluates lighting only at vertices C. It cannot represent diffuse reflection D. It always uses directional lights Correct Answer: B. It evaluates lighting only at vertices Question 6Which statement about normal mapping is correct? A. It changes the silhouette of an object B. It replaces the need for all geometric modeling C. It modifies local shading orientation without necessarily changing geometry D. It stores only diffuse albedo information Correct Answer: C. It modifies local shading orientation without necessarily changing geometry Question 7In a microfacet BRDF, what does the Fresnel term represent? A. The probability that a facet is geometrically visible B. The angle-dependent proportion of reflected light C. The number of samples used for antialiasing D. The distance-based attenuation of a point light Correct Answer: B. The angle-dependent proportion of reflected light Question 8Which light source naturally produces soft shadows because it has finite spatial extent? A. Point light B. Directional light C. Area light D. Ambient constant Correct Answer: C. Area light Question 9In a simplified metallic-roughness workflow, the base color of a metal primarily influences which response? A. Diffuse-only reflection B. Specular reflection tint C. Vertex position D. Shadow-map resolution Correct Answer: B. Specular reflection tint Question 10A developer makes a surface visually bright by assigning an emissive material in a basic rasterizer, but nearby objects remain dark. What is the best explanation? A. Emission cannot be displayed on a rasterized surface B. Visible emission does not automatically illuminate other objects C. Emissive materials always absorb light D. Rasterizers cannot render HDR values Correct Answer: B. Visible emission does not automatically illuminate other objects
|