View Full Version : Can concatenate projection matrix with viewport transformation matrix?

07-04-2002, 02:08 AM
As I understand it, the clip coords must first be divided with the Wc coord to yield NDC coords *before* the viewport transformation is applied...
However, the technique for projective textures calls for concatenating the projection matrix with the viewport transformation matrix(which consists of a scaling followed by a translation) into a single matrix which is then applied to the eye coords, finally performing perspective division with the Q coord to yield the actual texture coords.
Can this possibly be correct? I thought performing perspective division *after* viewport transformation would give different(and incorrect) results than performing perspective division *before* viewport transformation?


07-04-2002, 10:16 AM
Doesn't the projection matrix already include the perspective divide?

07-07-2002, 09:31 PM
Well, while the element in the last row/third column being -1 accounts for Wc being -Ze, the perspective division of Xc, Yc & Zc by Wc must take place *before* the scaling/translation of the viewport transformation in order for the window coordinates to turn out correct....and not *after*, since matrix multiplication is not commutative.
Otherwise the red book wouldn't explicitly state that the perspective division takes place *after* projection transformation and *before* viewport transformation....might as well combine the 2 together and save an extra matrix multiplication altogether.
Not sure if this is correct or not...