Exercise 3: Why a Missing Lighting Clamp Might Go Unnoticed — Possible Solution ==================================================================== WHY IT MIGHT "LOOK CORRECT" DURING TESTING ------------------------------ This chapter verified that a surface facing generally toward a light produces a positive dot product (approximately 0.6069 in the worked example), while a surface facing away produces a negative one (approximately -0.6069). In many ordinary test scenes, most visible surfaces genuinely do face at least somewhat toward at least one light source most of the time - that's typically how a scene is lit and composed by a designer, and camera-facing or upward-facing surfaces are common. If a rendering pipeline also happens to already clamp or otherwise sanitize color values somewhere further down the pipeline (for example, when converting a computed brightness into an 8-bit color channel, which is often clamped to a 0-255 range as a matter of course), a negative brightness value could get silently clamped to zero at THAT later stage instead, incidentally producing the same visual result as if the max(0, ...) check had been applied correctly at the lighting calculation itself - masking the missing clamp rather than genuinely avoiding its effects. A SPECIFIC SCENE WHERE THE BUG WOULD BECOME VISIBLE ------------------------------ The bug becomes clearly visible in a scene with multiple light sources affecting the same surface, where the renderer SUMS each light's contribution before any final clamping happens (a common, efficient design, since summing multiple lights' brightness contributions and clamping once at the very end is more natural than clamping after every individual light). In that case, one light positioned behind a surface would contribute a genuinely negative value into the running sum - actively subtracting from the total brightness contributed by other, correctly-lit lights, rather than contributing nothing at all as it should. A surface lit by two lights, one in front and one behind, would appear noticeably DARKER than a surface lit only by the one light in front, which is physically backwards - adding a second light source should never make a surface darker. This specific case (multiple lights summed before a final clamp) exposes the bug because there's no other clamping step positioned early enough in the pipeline to accidentally mask each individual light's own negative contribution. WHY THIS WORKS AS AN ANSWER ------------------------------ The explanation identifies a genuine, chapter-consistent reason the bug could hide during typical single-light testing (an incidental downstream clamp masking the missing one), and constructs a specific, plausible scene (multiple lights summed before clamping) where the missing clamp's effect - a surface getting darker from an additional light source - becomes an observable, physically nonsensical result rather than relying on a vague "it would eventually show up somehow."