0
\$\begingroup\$

I'm studying Perspective projection in a computer graphics course and i'm really confused about a detail. The study material says there are 3 cases:

  • Case 1: View plane parallel to the xy plane and Projection reference point (0,0,0)
  • Case 2: View plane coincident to the xy plane and Projection reference point (0,0,z)
  • Case 3: View plane parallel to the xy plane and Projection reference point (0,0,z)

In all these cases seems that all the objects to which we apply the perspective transform have a negative z. So my question is: Why all z are negative? Is it related to the previous step (so the camera transform?)?

\$\endgroup\$
  • \$\begingroup\$ It is because the camera is conceptually at (0, 0, 0), looking at -z. So everything with +z is behind the camera. The model-view matrix will position all the world objects according to this. There is thus no need to apply the perspective transform to the objects that are behind the camera. \$\endgroup\$ – Alexandre Vaillancourt Jun 30 '15 at 19:57
  • \$\begingroup\$ @AlexandreVaillancourt thank you for your answer. Let me see if I understood everything in the right way: the model matrix will transform the objects from their local coordinate system to the world coordinate system. The view (camera) matrix will transform the objects coordinates as their are in front of the camera. The transformation applied to obtain this fact translate the camera in (0,0,0) (and then rotate it), so all the objects in front of the camera will have negative z. Then we apply the perspective projection matrix to add the perspective to the various objects. Correct? \$\endgroup\$ – Fabrizio Duroni Jun 30 '15 at 20:06
  • \$\begingroup\$ The view matrix is just a representation of how the camera is positioned in the "world". The camera is not "moved", everything is transformed in it's frame for the rendering. All the vertices that have -z are behind the camera, while +z vertices may be in front (it's another test to see if they're in the frustum). [This site](Keep in mind that the transformations are applied to the vertices. This page seems to have a good bunch of info on the process!) has a bunch of information on OpenGL! \$\endgroup\$ – Alexandre Vaillancourt Jul 1 '15 at 12:34

Your Answer

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

Browse other questions tagged or ask your own question.