Test Vol 1 Jun. 2014 | Page 9

1. Defining the space – Defining the 3D space From the Picture 4 we can see that in a frustum there are two rectangles that face the same way. The smaller one is the projection plane (also called near plane and view plane) onto which the points will be projected. The bigger one is called far plane which is used to define the frustum. Only points and objects that are inside the frustum can be projected onto the projection plane. For the sake of keeping this part short and simple I will discuss actual projection in the part Projection. 3D Spaces Now that we know about the camera and that we need to project the points from 3D onto the projection plane to get the 2D image, we can define our 3D spaces. First of all we will need a space for all our objects and points to exist. Since points and objects define the game world, we will call that space world space. World space:  Space for all our points and objects to be  Infinite size  All positions are relative to the origin  Camera can be freely moved and oriented Basically right now we could just derive a method that finds points which are visible in the camera (inside the frustum), projects them onto the projection plane and maps the projected points to the screen space. The only problem is that both the camera and the points can be moved and oriented in world space. That makes computing everything a lot harder since we would need to take into account the fact that with the camera and the frustum can be moved and oriented in world space. Thus computing whether the point is inside the frustum is problematic. Fortunately we don’t need to move both the points and the camera. Instead moving only one of them does the job. Consider this real world example: you’re trying to make a picture of a flower on the table and you want to make flower appear bigger on the image. Provided that we can’t use camera’s zoom we can either move the camera closer to the flower or vice versa. In the end we would get the same effect. Because of that we can simplify the problem by defining yet another space. Clip space:  Camera is always looking down the positive z axis  Camera’s position is always at the origin  Z axis is at the frustum’s centr e and therefore intersects with the centre of projection plane Other than these two differences, the clip space is the same as world space. Picture 5 gives an idea of a frustum in the clip space. 7