Saturday, August 4, 2007

3D projection

A 3D projection is a mathematical transformation used to project three dimensional points onto a two dimensional plane[1]. Often this is done to simulate the relationship of a camera to a subject, as 3D projection is often the first step in the process of representing three dimensional shapes two dimensionally in computer graphics, a process known as rendering. The result of this process can look similar to a picture taken with a camera[2], or a perspective drawing in graphic arts


Data necessary for projection
Data about the objects to render is usually stored as a collection of points, linked together in triangles. Each point is a set of three numbers, representing its X,Y,Z coordinates from an origin relative to the object they belong to. Each triangle is a set of three such points. In addition, the object has three coordinates X,Y,Z and some kind of rotation, for example, three angles alpha, beta and gamma, describing its position and orientation relative to a "world" reference frame.
Last comes the observer (or camera). The observer has a set of three X,Y,Z coordinates and three alpha, beta and gamma angles, describing the observer's position and the direction in which it is pointing.
All this data is usually stored using floating point values, although many programs convert them to integers at various points in the algorithm to speed up the calculations.
Points like described above given relative to an object are said to be in object space, and need to be transformed into world space as a first step for projection [3]. The complete projection can be done in three steps to transform a point from object space to screen space, which are detailed in the following sections:
world transform Transform a point from object space to world space.
camera transform Transform a point from world space to camera space. This includes a translation so the projection plane goes through the origin, and a rotation so the projection plane is perpendicular to the camera direction [4].
perspective transform Project a point to the camera's view plane. This results in a 2D point in screen space[4].

No comments: