<p>When reading on transformation matrices over a range of distinct source material, there are some main concepts that you must understand, which are as follows.</p>
<h2>Column vs Row Notation</h2>
<p>Some authors write vectors as a single row matrix (1x3), while others write them as a single column matrix (3x1). The latter seems to be the preferred representation in most modern books on computer graphics. The main difference between the two notations is that when using the former, matrices will be multiplied on the right side of the vector, and when using the latter they will be multiplied on the left. When dealing with linear transformations, such as rotation matrices, in a particular notation, they are represented as the transposed matrix in the other notation. For instance, the rotation of point <span class="math-container">$p=(1, 1)$</span> for an angle <span class="math-container">$\theta$</span> in the plane is shown below. As you can easily see, <span class="math-container">$Row(x)^T = Column(x)$</span>, i.e., one notation is the transpose of the other.</p>
<p><span class="math-container">$$
\begin{align}
Row(p) =&amp; 
\begin{bmatrix}
1 &amp; 1
\end{bmatrix}
\begin{bmatrix}
\cos\theta &amp; \sin\theta\\
\sin\theta &amp; \cos\theta
\end{bmatrix}\\
Column(p) =&amp; 
\begin{bmatrix}
\cos\theta &amp; -\sin\theta\\
\sin\theta &amp; \cos\theta
\end{bmatrix}
\begin{bmatrix}
1 \\ 1
\end{bmatrix}
\end{align}
$$</span></p>
<p>The <a href="https://people.eecs.berkeley.edu/%7Ebarsky/perspective.html" rel="nofollow noreferrer">website you linked</a> uses <strong>row</strong> notation. This is important because if you read about the perspective matrix in other sources, you may see the result written as the transpose matrix if the author used column notation.</p>
<h2>Basis Orientation</h2>
<p><a href="https://people.eecs.berkeley.edu/%7Ebarsky/perspective.html" rel="nofollow noreferrer">In the website</a>, the camera basis vectors <span class="math-container">$X_1$</span>, <span class="math-container">$Y_1$</span>, and <span class="math-container">$Z_1$</span> form a left-handed coordinate system, because <span class="math-container">$X_1 \times Y_1 = - Z_1$</span>. This is important as well, as you may notice some sign changes in the perspective matrix if the system was right-handed. You can read more about handedness in <a href="https://en.wikipedia.org/wiki/Orientation_%28vector_space%29" rel="nofollow noreferrer">Wikipedia</a>. As with row notation, this is another arbitrary decision that the author has taken.</p>
<h2>Perspective Projection</h2>
<p>Given the appropriate basis, and a projection plane at a distance d from the origin, perspective projection is a simple exercise in similar triangles, as shown below.</p>
<p><a href="https://i.sstatic.net/Eh4rc.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Eh4rc.jpg" alt="Perspective Projection Diagram)" /></a></p>
<p>The point <span class="math-container">$\mathbf{P} = (x,y,z)$</span> when projected onto the plane gives another point <span class="math-container">$\mathbf{p} = (x_p, y_p, z_p)$</span> that can be written as (in row notation)
<span class="math-container">$$\mathbf{p} = \begin{bmatrix}
 d \displaystyle \frac{x}{z} &amp; d \displaystyle \frac{y}{z} &amp; d
\end{bmatrix}.$$</span></p>
<p>Now we just need to put this formula into matrix form (again, in row notation).</p>
<h2>Homogeneous/Projective Coordinates</h2>
<p>If we just use the raw 3D coordinates of <span class="math-container">$\bf P$</span> there is no way to represent the formula for <span class="math-container">$\bf p$</span> as a matrix multiplication. The use of <a href="https://en.wikipedia.org/wiki/Homogeneous_coordinates" rel="nofollow noreferrer">homogeneous coordinates</a> allows us exactly to do that. We start by augmenting <span class="math-container">$\bf P$</span> onto the fourth dimension, by defining it as <span class="math-container">$\mathbf{P} = (x, y, z, 1)$</span>, and we use 4x4 homogeneous matrices instead of 3x3 matrices to represent transformations. I strongly urge you to read on <a href="https://en.wikipedia.org/wiki/Projective_space" rel="nofollow noreferrer">projective spaces</a>, as otherwise the following explanation will look like too much hand-waving as I am not going to dwell on mathematical formalities.</p>
<p>Now, in this new space every point with coordinates <span class="math-container">$(wx,wy,wz,w)$</span> can be mapped onto the point <span class="math-container">$(x,y,z,1)$</span> by a simple division by w. We can use this property in our advantage to fill-out a matrix in such a way that after the division by w is made, we get exactly the perspective projection formula for our point.</p>
<p><span class="math-container">$$
\begin{bmatrix}
x &amp; y &amp; z &amp; \displaystyle\frac{z}{d}
\end{bmatrix}
= 
\begin{bmatrix}
x &amp; y &amp; z &amp; 1
\end{bmatrix}
\begin{bmatrix}
1 &amp; 0 &amp; 0 &amp; 0\\
0 &amp; 1 &amp; 0 &amp; 0\\
0 &amp; 0 &amp; 1 &amp; \displaystyle \frac{1}{d}\\
0 &amp; 0 &amp; 0 &amp; 0
\end{bmatrix}
$$</span></p>
<p>Now if we take the point <span class="math-container">$(x, y, z, \frac{z}{d})$</span> and we divide it by its last coordinate, we get <span class="math-container">$(d\displaystyle\frac{x}{z}, d\displaystyle\frac{y}{z}, d, 1)$</span>, which are exactly the coordinates of our projected point if we just ignore the augmentation onto fourth dimensional space that we did (i.e., discard the last coordinate).</p>
<p>As you can see, the &quot;perspective matrix&quot; does not actually do any perspective transformation, it just &quot;prepares&quot; the transformation by coding a specific value in the last coordinate, such that after all coordinates are divided by it, we get the true projection.</p>

CC BY-SA 4.0
2018-11-14T02:11:17.513Z
If I multiply the two matrices simply I get $\begin{bmatrix} x&& y&&z&&\frac{z}{d}+1\end{bmatrix}$
mathmaniage
CC BY-SA 4.0
2018-11-14T03:28:07.470Z
Sorry for the mistake! I typed the identity matrix in the editor and just changed it from there. I forgot to change the one to a zero in the last row. I edited the answer with the correction. Thanks for spotting it!
vgs
CC BY-SA 4.0
2018-11-14T05:21:05.063Z
is this derivation the same as: [this](https://computergraphics.stackexchange.com/questions/8254/perspective-projection-transformation-matrix?noredirect=1#comment11170_8254) derivation that I have done in the second derivation? What about the first derivation? Is it also only for one point perspective? Or is it more general for all point perspectives?
mathmaniage
CC BY-SA 4.0
2018-11-14T21:15:02.137Z
Yes they are quite the same, but it is likely that your frame of reference has a different definition (one or more axes pointing at a different direction) and for sure you were using column instead of row notation. The first derivation is also similar, but for some reason the author decided to generalize the center point of the projection. It is usual in graphics programming to let the center be the origin of camera space.
vgs
CC BY-SA 4.0
2018-11-15T06:39:32.903Z
just to be sure, the projection that  was being performed  in the link that I gave you in the comments above, is a one point projection,  even  if nothing was specified, right?
mathmaniage
CC BY-SA 4.0
2018-12-06T12:23:49.983Z
Yes. Technically, the matrix in this question is a 1-point perspective. However, if you combine this matrix with a simple rotation, as it is usually the case with the view matrix, which transforms from world space to camera space, then you will easily get 2-point or 3-point perspective in the combined matrix, i.e., perspective * view.
vgs
CC BY-SA 4.0
2018-11-13T21:26:08.210Z
2024-09-21T10:07:23.650Z
2024-09-21T10:07:23.650Z
vgs
<p>I found the derivation for two point and three point perspective <a href="https://people.eecs.berkeley.edu/~barsky/perspective.html" rel="nofollow noreferrer">here on this site</a>,  even though it says review on one point perspective,  it  doesn't give a link to previous pages, but I'd like to know how the matrix for one  point perspective was derived. If possible please give me a detailed derivation for this projection matrix.</p>

CC BY-SA 4.0
2024-09-25T05:37:17.033Z
Is there even such a thing as one point perspective really?
joojaa
CC BY-SA 4.0
2024-09-25T12:42:08.130Z
@joojaa, yes.  It's a drawing technique where you add a vanishing point to your page to assist in drawing axis-aligned lines in your scene.  It can be done by placing 1, 2, or 3 vanishing points. One could attempt to derive an arbitrary projection matrix from these vanishing points.  All 3 techniques have scale ambiguity, but you can certainly derive a matrix that conforms to a perspective constraint.
Wyck
CC BY-SA 4.0
2024-09-25T16:33:08.040Z
@Wyck yes but what happens if all your line are not aligned to a axis. So yes i agree you can have a image that only has lines that vanish to one point. Because it silly to say that such an image can not be drawn. But the perspective will have more vanishing points if you have lines that are not collinear. So im arguing the general perceptive is always omnipresent.
joojaa
CC BY-SA 4.0
2024-09-25T16:56:34.663Z
@joojaa With one-point perspective, the vanishing points for the x and y axes are placed ["at infinity"](https://en.wikipedia.org/wiki/Point_at_infinity) so that the lines remain parallel (do not intersect at the vanishing point).  The projection matrix captures this by having zeros that cause x and y to contribute nothing to the resultant z so that perspective is affected only by z as you divide to perform the actual projection.
Wyck
CC BY-SA 4.0
2024-09-25T17:08:26.213Z
@Wyck i understand that. But i see what your getting at. It still seems to me that its really only ever one point according to a wiever if you feed it specific data. rotate your object 45 degrees an you get what?
joojaa
<projections>
finding the projection matrix for one point perspective
mathmaniage
# finding the projection matrix for one point perspective

(Asked by: username_0 on 2018-11-12)

I found the derivation for two point and three point perspective [here on this site](https://people.eecs.berkeley.edu/~barsky/perspective.html), even though it says review on one point perspective, it doesn't give a link to previous pages, but I'd like to know how the matrix for one point perspective was derived. If possible please give me a detailed derivation for this projection matrix.

**Tags:** projections

> **Comments:**
> **username_1**: Is there even such a thing as one point perspective really?  
> **username_2**: @username_1, yes.  It's a drawing technique where you add a vanishing point to your page to assist in drawing axis-aligned lines in your scene.  It can be done by placing 1, 2, or 3 vanishing points. One could attempt to derive an arbitrary projection matrix from these vanishing points.  All 3 techniques have scale ambiguity, but you can certainly derive a matrix that conforms to a perspective constraint.  
> **username_1**: @username_2 yes but what happens if all your line are not aligned to a axis. So yes i agree you can have a image that only has lines that vanish to one point. Because it silly to say that such an image can not be drawn. But the perspective will have more vanishing points if you have lines that are not collinear. So im arguing the general perceptive is always omnipresent.  
> **username_2**: @username_1 With one-point perspective, the vanishing points for the x and y axes are placed ["at infinity"](https://en.wikipedia.org/wiki/Point_at_infinity) so that the lines remain parallel (do not intersect at the vanishing point).  The projection matrix captures this by having zeros that cause x and y to contribute nothing to the resultant z so that perspective is affected only by z as you divide to perform the actual projection.  
> **username_1**: @username_2 i understand that. But i see what your getting at. It still seems to me that its really only ever one point according to a wiever if you feed it specific data. rotate your object 45 degrees an you get what?  

---

## 1 answers

### Answer by username_3 on 2018-11-13. Score: 1 | Accepted answer

When reading on transformation matrices over a range of distinct source material, there are some main concepts that you must understand, which are as follows.

## Column vs Row Notation

Some authors write vectors as a single row matrix (1x3), while others write them as a single column matrix (3x1). The latter seems to be the preferred representation in most modern books on computer graphics. The main difference between the two notations is that when using the former, matrices will be multiplied on the right side of the vector, and when using the latter they will be multiplied on the left. When dealing with linear transformations, such as rotation matrices, in a particular notation, they are represented as the transposed matrix in the other notation. For instance, the rotation of point $p=(1, 1)$ for an angle $\theta$ in the plane is shown below. As you can easily see, $Row(x)^T = Column(x)$, i.e., one notation is the transpose of the other.

$$
\begin{align}
Row(p) =&
\begin{bmatrix}
1 & 1
\end{bmatrix}
\begin{bmatrix}
\cos\theta & \sin\theta\\
\sin\theta & \cos\theta
\end{bmatrix}\\
Column(p) =&
\begin{bmatrix}
\cos\theta & -\sin\theta\\
\sin\theta & \cos\theta
\end{bmatrix}
\begin{bmatrix}
1 \\ 1
\end{bmatrix}
\end{align}
$$

The [website you linked](https://people.eecs.berkeley.edu/%7Ebarsky/perspective.html) uses **row** notation. This is important because if you read about the perspective matrix in other sources, you may see the result written as the transpose matrix if the author used column notation.

## Basis Orientation

[In the website](https://people.eecs.berkeley.edu/%7Ebarsky/perspective.html), the camera basis vectors $X\_1$, $Y\_1$, and $Z\_1$ form a left-handed coordinate system, because $X\_1 \times Y\_1 = - Z\_1$. This is important as well, as you may notice some sign changes in the perspective matrix if the system was right-handed. You can read more about handedness in [Wikipedia](https://en.wikipedia.org/wiki/Orientation_%28vector_space%29). As with row notation, this is another arbitrary decision that the author has taken.

## Perspective Projection

Given the appropriate basis, and a projection plane at a distance d from the origin, perspective projection is a simple exercise in similar triangles, as shown below.

[![Perspective Projection Diagram)](https://i.sstatic.net/Eh4rc.jpg)](https://i.sstatic.net/Eh4rc.jpg)

The point $\mathbf{P} = (x,y,z)$ when projected onto the plane gives another point $\mathbf{p} = (x\_p, y\_p, z\_p)$ that can be written as (in row notation)
$$\mathbf{p} = \begin{bmatrix}
d \displaystyle \frac{x}{z} & d \displaystyle \frac{y}{z} & d
\end{bmatrix}.$$

Now we just need to put this formula into matrix form (again, in row notation).

## Homogeneous/Projective Coordinates

If we just use the raw 3D coordinates of $\bf P$ there is no way to represent the formula for $\bf p$ as a matrix multiplication. The use of [homogeneous coordinates](https://en.wikipedia.org/wiki/Homogeneous_coordinates) allows us exactly to do that. We start by augmenting $\bf P$ onto the fourth dimension, by defining it as $\mathbf{P} = (x, y, z, 1)$, and we use 4x4 homogeneous matrices instead of 3x3 matrices to represent transformations. I strongly urge you to read on [projective spaces](https://en.wikipedia.org/wiki/Projective_space), as otherwise the following explanation will look like too much hand-waving as I am not going to dwell on mathematical formalities.

Now, in this new space every point with coordinates $(wx,wy,wz,w)$ can be mapped onto the point $(x,y,z,1)$ by a simple division by w. We can use this property in our advantage to fill-out a matrix in such a way that after the division by w is made, we get exactly the perspective projection formula for our point.

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

Now if we take the point $(x, y, z, \frac{z}{d})$ and we divide it by its last coordinate, we get $(d\displaystyle\frac{x}{z}, d\displaystyle\frac{y}{z}, d, 1)$, which are exactly the coordinates of our projected point if we just ignore the augmentation onto fourth dimensional space that we did (i.e., discard the last coordinate).

As you can see, the "perspective matrix" does not actually do any perspective transformation, it just "prepares" the transformation by coding a specific value in the last coordinate, such that after all coordinates are divided by it, we get the true projection.

> **Comments:**
> **username_0**: If I multiply the two matrices simply I get $\begin{bmatrix} x&& y&&z&&\frac{z}{d}+1\end{bmatrix}$  
> **username_3**: Sorry for the mistake! I typed the identity matrix in the editor and just changed it from there. I forgot to change the one to a zero in the last row. I edited the answer with the correction. Thanks for spotting it!  
> **username_0**: is this derivation the same as: [this](https://computergraphics.stackexchange.com/questions/8254/perspective-projection-transformation-matrix?noredirect=1#comment11170_8254) derivation that I have done in the second derivation? What about the first derivation? Is it also only for one point perspective? Or is it more general for all point perspectives?  
> **username_3**: Yes they are quite the same, but it is likely that your frame of reference has a different definition (one or more axes pointing at a different direction) and for sure you were using column instead of row notation. The first derivation is also similar, but for some reason the author decided to generalize the center point of the projection. It is usual in graphics programming to let the center be the origin of camera space.  
> **username_0**: just to be sure, the projection that  was being performed  in the link that I gave you in the comments above, is a one point projection,  even  if nothing was specified, right?  
> **username_3**: Yes. Technically, the matrix in this question is a 1-point perspective. However, if you combine this matrix with a simple rotation, as it is usually the case with the view matrix, which transforms from world space to camera space, then you will easily get 2-point or 3-point perspective in the combined matrix, i.e., perspective * view.  

---

