1. Defining the space – Defining the 3D space
Picture 5: A frustum in the clip space
Advantages of clip space
On a first thought having two 3D spaces just make everything more complicated. But let’s consider the advantages of having a static camera.
In world space the frustum is a geometrical object and thus can be translated, rotated and scaled. Therefore these steps must be taken to project 3D point onto our screen:
1.
2.
3.
4.
5.
Transform frustum into its position
Check which points are inside the frustum (visible to the camera)
Project visible points onto projection plane
Transform projected points into projection space
Transform once more to the screen space
It may sound easy, but completing the second and third steps in this algorithm is tedious and time consuming. Fortunately, we can simplify both steps by defining the frustum in clip space.
For step 2 we define the positions of projection and far planes. We can do that by using so called control
point which is a point that indicates the position of the plane in space. Knowing that the camera is looking
down the z axis, the control point for each plane would be (0, 0, z), where z is some number. Since we have
two planes (projection and far), we define two control points which are (0, 0, znear) and (0, 0, zfar) where znear
and zfar are z values for near (projection) plane and far plane. If we look at the frustum in clip space down
the x axis (from left or right side)(Picture 6), we will notice that znear and zfar are also planes’ distances from
the origin.
8