2. Projection – Depicting the projection
2 Projection
So far we have been only transforming points between spaces with the same dimensions (3D world space
to 3D clip space and 2D projection space to 2D screen space), but what about transforming points between
spaces with different dimensions? How can we transform a point from 3D clip space to 2D projection space
so that we can actually get the effect of perspective? The answer is projection. Think of projection like casting a shadow onto a wall: you have a light source, an object and a wall onto which the shadow will appear.
In this example the shadow is a 2D projection of a 3D object.
To make a successful 3D to 2D projection we need the following:
A plane onto which to project (a wall)
A point to project (an object)
A camera to specify how the projection should be done (a light source)
In part Defining the space we defined the projection plane and the connection between the plane and projection space. We also talked about camera and how it behaves in our game. Therefore we are set and
ready to project our points to our screen.
2.A Depicting the projection
The first problem is to plot the right image of projection to get an idea of what we are trying to do. Since
the projection will happen in clip space, we need to make an image of it. To make drawing easier, we can
draw two 2D images of clip space: one from top to bottom (x, z) and another one from right to left (z, y).
Now we can start plotting the projection. In section Defining the 3D space” I mentioned that camera is used
for “looking” at the points, or in other words, creating a vector CP = P – C where C is camera’s position and
P is the point. If you have done frustum culling correctly, it is guaranteed that CP will go through the projection plane at some point. That intersection point is our projection onto the projection plane which is what