Selection in 3D Graphics Environments
Christine Albert and Lindsey Press

A series of three matricies multiplied by one another results in the viewport transformation. To find the viewport space, the coordinate system must be shifted from the center to the upper left corner (matrix M1). Following this, it must be flipped so that the y-axis points down (matrix M2). Finally, the coordinate system must be scaled by the width and height of the screen (matrix M3). Note that we are working with a 2x2x2 cube, so in the M2 matrix we are using (maxz-minz)/2, not (maxz-minz). The matricies for this shift and their inverses are shown below:

M1, M2, M3:

In order to find the resulting inverse matricies, the three inverse matricies listed above are multiplied by one another in the following order: inverse of M1 x inverse of M2 x inverse of M3. The final result of this multiplaction is displayed below: