1
$\begingroup$

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

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)$

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Julien Guertault Aug 27 '18 at 4:18
  • 1
    $\begingroup$ 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)$. $\endgroup$ – Julien Guertault Aug 27 '18 at 13:49
  • 1
    $\begingroup$ @raindrop - Check this link might come handy. computergraphics.stackexchange.com/questions/6365/… $\endgroup$ – gallickgunner Aug 28 '18 at 18:32
1
$\begingroup$

This is pretty straightforward matrix math and can be found on Wikipedia. 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 or Computer Graphics, Principles and Practice.

$\endgroup$
  • $\begingroup$ I accept that the math is elaborate and I will really have to put in the time to study it. $\endgroup$ – raindrop Aug 27 '18 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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