5
$\begingroup$

If I have a point in world space: (wx, wy, wz)

and I have a centre of projection: (cx, cy, cz)

and I wanted to project that point using perspective projection

would my point on the screen be calculated by:

x = (cz * wx) / wz y = (cz * wy) / wz

I got this from this lecturer https://www.youtube.com/watch?v=VpNJbvZhNCQ I don't understand what he means by the variable 'd'. What would the variable 'd' be?

$\endgroup$
  • $\begingroup$ Once you get into this, you're going to have to come to terms with homogeneous coordinates. Here is a nice introduction to projection. $\endgroup$ – Brett Hale Nov 29 '16 at 13:30
2
$\begingroup$

In the video you linked to, $d$ is just the distance from the eye to the image plane. To simplify things though, you can just set $d$ to 1, which is the usual case and causes it to disappear from the formulas.

Your formula for projection is a bit wrong but don't worry, projection is actually pretty simple.

$x_{Screen} = x_{World} / z_{World}\\ y_{Screen} = y_{World} / z_{World}$

If you want to move the center of projection, you can do so with a screen space coordinate, by modifying the formula to be this:

$x_{Screen} = x_{World} / z_{World} - x_{ScreenCenter}\\ y_{Screen} = y_{World} / z_{World} - y_{ScreenCenter}$

If you want to re-introduce the $d$ value to control the distance from the eye to the projection plane, you can use the formula below. Adjusting $d$ will make the camera look like it is zooming in or out. Again, you can just set $d$ to 1 though and not deal with it.

$x_{Screen} = d*x_{World} / z_{World} - x_{ScreenCenter}\\ y_{Screen} = d*y_{World} / z_{World} - y_{ScreenCenter}$

$\endgroup$

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.