[ad_1]
As mentioned in the question, the author makes a rather misleading statement:
Observe that this equation modifies the w-component so that sw=n\$\cdot\$L. Thus, when the perspective divide takes place, each coordinate of s will be divided by n\$\cdot\$L; this is how we get the division by n\$\cdot\$L using matrices.
(The equation in question is the planar shadow projection equation.)
Transforming a projected shadow vertex using the projection matrix does indeed override the vertex’s w component with its z component, thus knocking out the n\$\cdot\$L factor.
However, turns out it doesn’t get factored into the xy NDCs, and is not a factor in the perspective divide.
To see this, suppose that we transform a vertex using the shadow matrix, then divide by n\$\cdot\$L and transform the resulting point to clip space using the perspective projection matrix. (It doesn’t matter if we do the division before or after the transformations since it’s a scalar and scalar-matrix multiplication is commutative.)
Since all clip space coordinates are divided by n\$\cdot\$L (including the w component), the perspective divide will simply cancel it out.
A caveat to keep in mind though:
The n\$\cdot\$L does get factored into the NDC z component so it has some bearing on z-buffering, but I’m not yet sure what the implications are.
[ad_2]