Exercise 3: Why Precomputing a Combined Transform Matters for 10,000 Vertices — Possible Solution ==================================================================== WHAT THE TWO APPROACHES ACTUALLY COST ------------------------------ Transforming each of 10,000 vertices through local -> world -> camera as three SEPARATE matrix multiplications means performing three full matrix-vector multiplications per vertex - 30,000 matrix-vector multiplications total for the whole object, every single frame. Precomputing the single combined local-to-camera matrix ONCE (by multiplying the world-to-camera matrix and the local-to-world matrix together, a single matrix-matrix multiplication done once per object, not per vertex) and then applying that one combined matrix to each vertex means only 10,000 matrix-vector multiplications total - one per vertex, instead of three. WHY THIS SAVES REAL WORK, NOT JUST CODE COMPLEXITY ------------------------------ This chapter verified directly that applying each transformation step separately and applying one precomputed combined matrix produce EXACTLY the same result (a measured difference of 0.0 in the worked pipeline example) - so there is no accuracy tradeoff at all, only a work tradeoff. Since every one of the object's 10,000 vertices needs the identical local-to-world and world-to-camera transformation (the object as a whole has only one position and orientation, shared by every vertex belonging to it), computing that combined transformation once and reusing it for every vertex avoids redoing the exact same matrix-matrix multiplication 10,000 times over for no benefit - the local-to-world and world-to-camera matrices don't change from one vertex to the next within the same object and the same frame. THE SCALE OF THE SAVINGS ------------------------------ Precomputing the combined matrix reduces the total number of matrix multiplications from roughly three times the vertex count (30,000) to the vertex count itself plus one extra matrix-matrix multiplication (10,000 + 1), which is very close to a threefold reduction in the total transformation work for that object, at essentially zero implementation cost (a small amount of extra code to multiply the two transform matrices together once) and, per this chapter's own verified finding, zero cost in accuracy. WHY THIS WORKS AS AN ANSWER ------------------------------ The answer quantifies the actual number of matrix operations each approach requires rather than describing the improvement only qualitatively, explains why every vertex of the same object shares the identical local-to-world and world-to-camera matrices (making the precomputation valid), and grounds the claim that no accuracy is lost in this chapter's own explicitly verified 0.0-difference finding.