In one text, the derivation for perspective projection goes like this: image1

If $x',y',z'$ represent any point along the projection line,and $x_{prp},y_{prp},z_{prp}$ are the projection reference point, then:

$$y'=y-(y-y_{prp})u$$ $$z'=z-(z-z_{prp})u$$ where $0\le u \le 1$

Now, finding the value of u from the third equation above and replacing in the first and second equations, we get at $z_vp$:

$$ x_p=x'= x.\frac{z_{vp}-z_{prp}}{z-z_prp}+x_{prp}.\frac{z-z_{vp}}{z-z_{prp}}$$ $$ y_p=y'= y.\frac{z_{vp}-z_{prp}}{z-z_prp}+y_{prp}.\frac{z-z_{vp}}{z-z_{prp}}$$

and there is no projection transformation matrix given.

In the second text, the derivation is using similar triangles:
comparing the similar triangles we get: $$x_p=\frac{-x_c}{\frac{z_c}{d}}$$ $$y_p=\frac{y_c}{\frac{z_c}{d}}$$

and the projection transformation for homogeneous coordinates x,y,z is given by: $$ \begin{bmatrix} -1&&0&&0&&0\\ 0&&1&&0&&0\\ 0&&0&&1&&0\\ 0&&0&&\frac{1}{d}&&0 \end{bmatrix} $$

so, my questions are:

  • How do I find the projection matrix of coordinates as found from derivation 1?
  • Both are given in the perspective projection area of these different texts, are both transformations the same? If not, how are they different?
  • $\begingroup$ I think that my answer to your other question applies here as well. $\endgroup$
    – vgs
    Nov 13, 2018 at 21:38

1 Answer 1


Given your equations (which i just assume are correct): $$ \begin{align} x_p &= x \frac{z_{vp}-z_{prp}}{z-z_{prp}}+x_{prp} \frac{z-z_{vp}}{z-z_{prp}}\\ y_p &= y \frac{z_{vp}-z_{prp}}{z-z_{prp}}+y_{prp} \frac{z-z_{vp}}{z-z_{prp}} \end{align}, $$

if we take $(x_{prp}, y_{prp}, z_{prp}) = (0, 0, 0)$, then we have

$$ \begin{align} x_p &= x\frac{z_{vp}}{z}\\ y_p &= y\frac{z_{vp}}{z} \end{align} $$

Assuming the projection plane is at distance $d$ from the origin, and, by your drawing, that the projection plane is on the negative side of the Z axis, we have $z_{vp} = -d$, which leads to

$$ \begin{align} x_p &= - x\frac{d}{z}\\ y_p &= - y\frac{d}{z} \end{align} $$

Now we can follow the same reasoning (homogeneous coordinates) as in my answer to your other question (using column notation) to write

$$ \begin{align} \begin{bmatrix} x\\y\\z\\ \frac{-z}{d} \end{bmatrix} = \begin{bmatrix} 1&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&\frac{-1}{d}&0 \end{bmatrix} \begin{bmatrix} x\\y\\z\\1 \end{bmatrix} \end{align} $$

which after the division by the last coordinate will give the projected point. Notice that because we are writing it in column notation, the perspective matrix is the transpose of the matrix in your other question. Also, the negative sign is because the camera reference frame is a right-handed one.

As for the second textbook that you are reading, I cannot understand why you would have a negative sign only in the x axis without knowing more about the camera reference frame. By the diagram you posted, there should not be a negative sign.

  • $\begingroup$ thank you for answering here as well, one user pointed out that the negative sign was due to reflection on the yz plane to correct the reference frame.... so the x coord was reflected was what he said. $\endgroup$ Nov 15, 2018 at 6:41
  • $\begingroup$ if you have some time, could you please take a look at this question of mine , I can't really seem to understand the given explanation. $\endgroup$ Nov 15, 2018 at 6:43
  • $\begingroup$ Sorry for taking me so long to answer your comment. Another user has already answered your question, and it seems to be correct. If you just apply the perspective matrix as shown above, every z-value will map to d, losing the information about object ordering, which is needed for the Z-buffer algorithm to correctly render the scene. So, the original range of Z values is usually mapped to another range, such that after perspective projection, Z is mapped to normalized device coordinates, as expected by your graphics API of choice. $\endgroup$
    – vgs
    Dec 6, 2018 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.