3
\$\begingroup\$

I have an existing class which transforms 3D vectors and projects them on a 2D plane (Camera). The code is all written in C without help from an external library.

To project a single vector (X,Y,Z) on the screen, the code first applies the View matrix of the camera and then for the actual projection does the following:

ScreenX=X/Z;
ScreenY=Y/Z;

ScreenX and ScreenY are then used as the screen coordinates (after additional scaling and translation).

What kind of projection is this?

Since it uses the Z coordinate to adjust the X and Y coordinates, I would think it is a perspective projection, but I'm not sure. If it's indeed a perspectice projection, then what would be the FOV for this?

I'm just trying to understand how the existing code works so that I can rebuild it using standard libraries and using a standard projection matrix if possible.

Any idea?

Edit - Some more information:

After this division, the coordinates are multiplied (scaled) by the "lens resolution" (pixels per unit) and translated by the lens center (X,Y coordinates in pixels):

ScreenX = ScreenX * Res + CenterX;
ScreenY = ScreenY * Res + CenterY;

Res is a large number and I'm guessing it defines the projection plane, letting the coordinates scale from 0 to the size of the actual image in pixels.

\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

After some more research I found out it's a Pinhole Camera Model. It is supposed to model a real camera.

There is a nice description here: http://www.epixea.com/research/multi-view-coding-thesisse8.html

What I was having trouble understanding was that I need some sort of projection plane. If there is no projection plane, all pixels would basically meet in the same singular point and would have the same coordinates. This is basically the same as the Near Plane in a perspective projection. It is a very small value, but it can't be zero.

There is no Far-Plane, since in a real camera there is no clipping of far objects. Just like in a real camera this means that you don't have a Z (depth) value that you can use.

\$\endgroup\$
3
\$\begingroup\$

It is a perspective projection, but those elements alone do not define the field of view.

This article covers more of the basics of the components of a projection. http://msdn.microsoft.com/en-us/library/aa916436.aspx

\$\endgroup\$
8
  • \$\begingroup\$ I think they do define a FOV of atan(1/1) * 2 = 90°. \$\endgroup\$
    – msell
    Commented Apr 26, 2013 at 18:03
  • \$\begingroup\$ @msell sure, they might have a hidden unity in there. I would look for the FOV in that view matrix first. \$\endgroup\$ Commented Apr 26, 2013 at 18:42
  • \$\begingroup\$ I should mention that the View matrix I have represents a real camera, not a virtual one. So I'm not sure how the concepts of a near and far plane apply to this. They would be 0 and infinity. Besides, the existing code works, I just don't know why... \$\endgroup\$
    – aKzenT
    Commented Apr 26, 2013 at 20:14
  • \$\begingroup\$ The View Matrix I calculate myself from the known world coordinates and rotation in space. So no hidden FOV there.. \$\endgroup\$
    – aKzenT
    Commented Apr 26, 2013 at 20:16
  • \$\begingroup\$ Please see my edit. I think maybe I found the missing "plane" hidden in another parameter. What do you think? \$\endgroup\$
    – aKzenT
    Commented Apr 26, 2013 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .