<p>This is pretty straightforward matrix math and can be found on <a href="https://en.wikipedia.org/wiki/3D_projection" rel="nofollow noreferrer">Wikipedia</a>. It's quite elaborate, though, if you want to learn the math behind it and the other types of projection that exist. I will encourage you to checkout either <a href="https://rads.stackoverflow.com/amzn/click/1568814240" rel="nofollow noreferrer">Real-Time Rendering</a> or <a href="https://www.amazon.co.uk/Computer-Graphics-Principles-Practice-Practices/dp/0321399528" rel="nofollow noreferrer">Computer Graphics, Principles and Practice</a>.</p>

CC BY-SA 4.0
2018-08-27T13:19:34.177Z
I accept that the math is elaborate and I will really have to put in the time to study it.
raindrop
CC BY-SA 4.0
2018-08-27T07:23:47.593Z
2018-08-27T07:23:47.593Z
beyond
<p>I am trying to find an equation for a camera projection.
The goal is to map the point $P(P_x, P_y, P_z)$ from the world coordinates onto the window coordinates $Q(Q_x, Q_y)$.</p>

<p><a href="https://i.sstatic.net/hlTMG.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hlTMG.jpg" alt="enter image description here"></a></p>

<p>The eye of viewing is located a distance D from the $\hat{e_1}$-$\hat{e_2}$ plane, and in the direction of -$\hat{e_3}$.
$\hat{e_1}$, $\hat{e_2}$ and $\hat{e_3}$ are unit vectors.</p>

<p>What is the equation to map P from world coordinates to window coordinates?
$\vec{Q}(Q_x, Q_y) = f(\vec{P}, \hat{e_1}, \hat{e_2}, \hat{e_3}, \vec{v}, \vec{c})$
with all the vectors on the right side described in terms of world coordinates, eg</p>

<p>$\vec{P} = (P_x, P_y, P_z)$</p>

<p>$\vec{C} = (C_x, C_y, C_z)$</p>

<p>$\vec{e_1} = ({e_1}_x, {e_1}_y, {e_1}_z)$</p>

<p>$\vec{e_2} = ({e_2}_x, {e_2}_y, {e_2}_z)$</p>

<p>$\vec{e_3} = ({e_3}_x, {e_3}_y, {e_3}_z)$</p>

CC BY-SA 4.0
2018-08-27T04:18:46.737Z
If you don't know where to start, you can work on a simpler version of the problem: instead of projecting from a 3D space to a 2D screen, try projecting from 2D space to a 1D screen. Work one transformation at a time, and the equation in 2D becomes reasonably simple. Then you can redo it in 3D.
Julien Guertault
CC BY-SA 4.0
2018-08-27T13:49:57.437Z
By the way, the convention is usually to name the components of a vector $\vec{V} = (V_x, V_y, V_z)$ rather than $\vec{V} = (x_v, y_v, z_v)$.
Julien Guertault
CC BY-SA 4.0
2018-08-28T18:32:00.593Z
@raindrop - Check this link might come handy. https://computergraphics.stackexchange.com/questions/6365/inverse-value-in-a-perspective-matrix/6366#6366
gallickgunner
<camera>
Equation for camera projection
raindrop
# Equation for camera projection

(Asked by: username_0 on 2018-08-27)

I am trying to find an equation for a camera projection.
The goal is to map the point $P(P\_x, P\_y, P\_z)$ from the world coordinates onto the window coordinates $Q(Q\_x, Q\_y)$.

[![enter image description here](https://i.sstatic.net/hlTMG.jpg)](https://i.sstatic.net/hlTMG.jpg)

The eye of viewing is located a distance D from the $\hat{e\_1}$-$\hat{e\_2}$ plane, and in the direction of -$\hat{e\_3}$.
$\hat{e\_1}$, $\hat{e\_2}$ and $\hat{e\_3}$ are unit vectors.

What is the equation to map P from world coordinates to window coordinates?
$\vec{Q}(Q\_x, Q\_y) = f(\vec{P}, \hat{e\_1}, \hat{e\_2}, \hat{e\_3}, \vec{v}, \vec{c})$
with all the vectors on the right side described in terms of world coordinates, eg

$\vec{P} = (P\_x, P\_y, P\_z)$

$\vec{C} = (C\_x, C\_y, C\_z)$

$\vec{e\_1} = ({e\_1}\_x, {e\_1}\_y, {e\_1}\_z)$

$\vec{e\_2} = ({e\_2}\_x, {e\_2}\_y, {e\_2}\_z)$

$\vec{e\_3} = ({e\_3}\_x, {e\_3}\_y, {e\_3}\_z)$

**Tags:** camera

> **Comments:**
> **username_1**: If you don't know where to start, you can work on a simpler version of the problem: instead of projecting from a 3D space to a 2D screen, try projecting from 2D space to a 1D screen. Work one transformation at a time, and the equation in 2D becomes reasonably simple. Then you can redo it in 3D.  
> **username_1**: By the way, the convention is usually to name the components of a vector $\vec{V} = (V_x, V_y, V_z)$ rather than $\vec{V} = (x_v, y_v, z_v)$.  
> **username_2**: @username_0 - Check this link might come handy. https://computergraphics.stackexchange.com/questions/6365/inverse-value-in-a-perspective-matrix/6366#6366  

---

## 1 answers

### Answer by username_3 on 2018-08-27. Score: 1 | Accepted answer

This is pretty straightforward matrix math and can be found on [Wikipedia](https://en.wikipedia.org/wiki/3D_projection). It's quite elaborate, though, if you want to learn the math behind it and the other types of projection that exist. I will encourage you to checkout either [Real-Time Rendering](https://rads.stackoverflow.com/amzn/click/1568814240) or [Computer Graphics, Principles and Practice](https://www.amazon.co.uk/Computer-Graphics-Principles-Practice-Practices/dp/0321399528).

> **Comments:**
> **username_0**: I accept that the math is elaborate and I will really have to put in the time to study it.  

---

