Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I understand the traditional way(use similar triangle and make depth value linear) to deduce the perspective projection matrix. But I want to try another approach after I read this text: Fundamentals of Texture Mapping and Image Warping.

On page 17, it says that a quad can be mapped to a square using projective transformation, which can be expressed as a rational linear mapping:

$$\mathit{x} = \frac{\mathit{a}\mathit{u} + \mathit{b}\mathit{v} + \mathit{c}} {\mathit{g}\mathit{u} + \mathit{h}\mathit{v} + \mathit{i}}\\ \mathit{y} = \frac{\mathit{d}\mathit{u} + \mathit{e}\mathit{v} + \mathit{f}} {\mathit{g}\mathit{u} + \mathit{h}\mathit{v} + \mathit{i}}$$

After I substitute four vertices of the quad and square, I get a linear system. By solving the linear system I can get the projective transformation matrix.

Similarly, I conceive that a 3D projective mapping can be denoted as a rational linear mapping as well. And this rational linear mapping can map a frustum to a NDC cube.(note that because of the use of homogeneous coordinate, the last element of matrix(right bottom one) can be set to 1)

$$ \mathit{x} = \frac{\mathit{a}\mathit{u} + \mathit{b}\mathit{v} + \mathit{c}\mathit{w} + \mathit{d}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1}\\ \mathit{y} = \frac{\mathit{e}\mathit{u} + \mathit{f}\mathit{v} + \mathit{g}\mathit{w} + \mathit{h}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1}\\ \mathit{z} = \frac{\mathit{i}\mathit{u} + \mathit{j}\mathit{v} + \mathit{k}\mathit{w} + \mathit{l}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1} $$

But when I try to solve this system, the result matrix is not as same as the one in 3D API(like OpenGL) specification.

My question is: is there any extra properties of a perspective projection matrix that a rational linear mapping does not have?

EDIT: I found that in the 2D version we have 8 unknowns(3*3, and one matrix element set to 1 excluded), which equals exactly the number of equations in the linear system(4 vertices in a quad, and 2 corrdinate components in each of them). However in the 3D version, the number of unknowns and the number of equations does not match. I suspect I misunderstand the rational linear mapping, and the reason why it can applied to a 2D version is just a coincidence. I will do more learn on this topic.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

In $2D$, a perspective map can map any $4$ non-collinear points to any $4$ other points. Therefore, a perspective map has $8$ ($4\times2$) independent elements ($3\times3-1$).

In $3D$, a perspective map can map any $5$ non-coplanar points to any $5$ other points. Therefore, a perspective map has $15$ ($5\times3$) independent elements ($4\times4-1$).

In this answer, I develop the $2D$ matrix to map any $4$ non-collinear points to any $4$ other points. This method can be extended to $3D$.


A $3D$ point can be imbedded in $4D$: $$ [x,y,z]\mapsto[x,y,z,1] $$ and a $4D$ point can be projected to $3D$: $$ [x,y,z,r]\mapsto\left[\frac{x}{r},\frac{y}{r},\frac{z}{r}\right] $$ A perspective mapping imbeds a $3D$ point in $4D$, performs a $4\times4$ matrix multiplication, then projects the $4D$ result back to $3D$: $$ M:\left[\begin{array}{cc}x&y&z\end{array}\right]\mapsto\left[\begin{array}{ccc}x&y&z&1\end{array}\right]M=\left[\begin{array}{ccc}u&v&w&s\end{array}\right]\mapsto\left[\begin{array}{cc}\frac{u}{s}&\frac{v}{s}&\frac{w}{s}\end{array}\right] $$ Given any $5$ points in $\mathbb{R}^3$, $[x_n,y_n,z_n]_{n=1}^5$, no $4$ of which are coplanar, compute $$ \left[\begin{array}{ccc}d_1&d_2&d_3&d_4\end{array}\right]=\left[\begin{array}{ccc}x_5&y_5&z_5&1\end{array}\right]\left[\begin{array}{ccc}x_1&y_1&z_1&1\\x_2&y_2&z_2&1\\x_3&y_3&z_3&1\\x_4&y_4&z_4&1\end{array}\right]^{-1} $$ and define $$ M_{[x\;y\;z]}=\left[\begin{array}{ccc}d_1x_1&d_1y_1&d_1z_1&d_1\\d_2x_2&d_2y_2&d_2z_2&d_2\\d_3x_3&d_3y_3&d_3z_3&d_3\\d_4x_4&d_4y_4&d_4z_4&d_4\end{array}\right] $$ Then for $5$ other points $\mathbb{R}^3$, $[u_n,v_n,w_n]_{n=1}^5$, we have $$ M_{[x\;y\;z]}^{-1}M_{[u\;v\;w]}:\left[\begin{array}{cc}x_n&y_n&z_n\end{array}\right]\mapsto\left[\begin{array}{cc}u_n&v_n&w_n\end{array}\right] $$

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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