0% found this document useful (0 votes)
125 views4 pages

3D Object Projections and Transformations

This document discusses 3D projections and transformations. It describes how 3D objects are represented by planar facets defined by vertices. To display 3D objects on a 2D screen, a projection transforms the 3D coordinates to 2D. There are two main types of projections: parallel (orthographic) and perspective. Parallel projections use parallel lines while perspective projections pass through a viewpoint. Transformations like translation, scaling and rotation are represented by matrices applied to homogeneous coordinates to manipulate 3D scenes.

Uploaded by

seventhhemanth
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views4 pages

3D Object Projections and Transformations

This document discusses 3D projections and transformations. It describes how 3D objects are represented by planar facets defined by vertices. To display 3D objects on a 2D screen, a projection transforms the 3D coordinates to 2D. There are two main types of projections: parallel (orthographic) and perspective. Parallel projections use parallel lines while perspective projections pass through a viewpoint. Transformations like translation, scaling and rotation are represented by matrices applied to homogeneous coordinates to manipulate 3D scenes.

Uploaded by

seventhhemanth
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lecture 2: Projection and Transformation

3-Dimensional Objects Bounded by Planar Surfaces (Facets) A planar facet is defined by an ordered set of 3D vertices, lying on one plane, which form a closed polygon, (straight lines are drawn from each vertex to the following one with the last vertex connected to the first). The data describing a facet are of two types. First, there is the numerical data which is a list of 3D points, (3*N numbers for N points), and secondly, there is the topological data which describes which points are connected to form edges of the facet. Projections of Wire-Frame Models Since our display device is only 2D, we have to define a transformation from the 3D space to the 2D surface of the display device. This transformation is called a projection. In general, projections transform an n-dimensional vector space into an m-dimensional vector space where m<n. Projection of a 3D object onto a 2D surface is done by selecting first the projection surface and then defining projectors or lines 3D Object which are passed through each Plane of Projection vertex of the object. The arrangement is shown in Diagram Vi 2.1. The projected vertices are placed where the projectors intersect Diagram 2.1 the projection surface. The most Viewpoint Planar projection common (and simplest) projections used for viewing 3D scenes use planes for the projection surface and Projection of Vi Projector straight lines for projectors. These are called planar geometric projections. The simplest form of viewing an object is by drawing all its projected edges. This is called a wireframe representation, since the object could be modelled in three dimensions using wires for the edges of the object. Note that for such viewing the topological information for the facets is not required. There are two common classes of planar geometric projections. Parallel projections use parallel projectors, perspective projections use projectors which pass through one single point called the viewpoint. In order to minimise confusion in dealing with a general projection problem, we can standardise the plane of projection by making it always parallel to the z=0 plane, (the plane which contains the x and y axis). This does not limit the generality of our discussion because if the projection plane of the actual scene is not parallel to the z=0 plane then we can use coordinate transformations in 3D and make the projection plane parallel to the z=0 plane. We shall restrict the viewed objects to be in the positive half space (z>0), therefore the projectors starting at the vertices will always run in the negative z direction. Parallel Projections If the direction of a projector is given by vector d=[dx, dy, dz], and it passes through the vertex V=[Vx, Vy, Vz] it may be expressed by the parametric line equation: P = V + d In orthographic projection the projectors are perpendicular to the projection plane, which we define as z=0. In this case the projectors are in the direction of the z axis and: d = [0,0,-1] and so Px = Vx and Py = Vy
Computer Graphics Lecture 2: 3D objects and projections Page: 1

which means that the x and y co-ordinates of the projected vertex is equal to the x and y co-ordinates of the vertex itself and no calculations are necessary. A cube drawn in orthographic projection is shown in Diagram 2.2.

Looking at a Face

General View

Looking at a vertex

Diagram 2.2 Orthographic (parallel) projection of a cube

If the projectors are not perpendicular to the plane of projection then the projection is called oblique. The projected vertex intersects the z=0 plane where the z component of the P vector is equal to zero, therefore: Pz = 0 = Vz + dz so = - Vz/ dz and we can use this value of to compute: Px = Vx + dx = Vx - dxVz/ dz and Py = Vy + dy = Vy - dyVz/ dz These projections are similar to the orthographic projection with one or other of the dimensions scaled. They are not often used in practice. Perspective Projections In perspective projection, all the rays pass Y Projected point Scene through one point in space, the centre of projection, which we will designate with the capital letter C, as shown in Diagram Z Projector 2.5. If the centre of projection is behind the plane of projection then the orientation of Plane of Projection (z=f) the image is the same as the image. By contrast, in a pin hole camera it is inverted. To calculate perspective projections we f adopt a canonical form in which the centre of projection is at the origin, and the X projection plane is placed at a constant z Viewpoint value, z=f. The projection of a 3D point onto the z=f plane is calculated as follows. Diagram 2.3: Canonical form for Perspective projection If the centre of projection is at the origin, and we are projecting the point V then the projector has equation: P = V Since the projection plane has equation z=f, it follows that: f = Vz If we write p = f/ Vz for the intersection point on the plane of projection then: thus Px = p Vx = f* Vx/ Vz and Py = p Vy = f* Vy / Vz The factor p is called the foreshortening factor, because the further away an object is, the larger Vz and the smaller is its image. The perspective projection of a cube is shown in Diagram 2.4.

Computer Graphics Lecture 2: 3D objects and projections

Page: 2

The introduction of canonical forms for perspective and orthographic General View Looking at a Face projection simplifies their computation. However it means that we must be able to transform a scene, which Diagram 2.4 could be defined in any 3D Looking at a vertex Perspective projection of coordinate system, such that a cube the view direction is along the z axis and (for perspective projection) the viewpoint is at the origin. In general we would like to change the coordinates of every point in the scene, such that some chosen viewpoint C = [Cx,Cy,Cz] is the origin and some view direction d = [dx,dy,dz] is the Z axis. Frequently, we may want to transform the points of a graphical scene for other purposes such as generation of special effects in pictures, like rotating objects. Transformations of this kind are achieved by multiplying every point of the scene by a transformation matrix. Unfortunately however, we cannot perform a general translation using normal Cartesian coordinates, and for that reason we now introduce a system called homogeneous coordinates. Three dimensional points expressed in homogeneous form have a fourth ordinate: P = [px, py, pz,s] The fourth ordinate is a scale factor, and conversion to Cartesian form is achieved by dividing it into the other ordinates, so [px, py, pz,s] has Cartesian coordinate equivalent [px/s, py/s, pz/s]. In most cases, s will be 1. The point of introducing homogenous coordinates is to allow us to
[ x, y, z, 1] 1 0 0 tx 0 1 0 ty 0 0 1 tz 0 0 0 1 = [x+tx, y+ty, z+tz, 1 ]

translate the points of a scene by using matrix multiplication. The matrix for scaling a graphical scene is also easily expressed in homogenous form:
[x, y, z, 1] sx 0 0 0 0 sy 0 0 0 0 sz 0 0 0 0 1 = [sx*x, sy*y, sz*z, 1]

Notice that these two transformations are not commutative, and it is essential that they are carried out in the correct order. Diagram 2.5 illustrates the problem for a simple picture.

Graphics Scene (Square at origin)


Y Scale x:=x*2 Y Translate

Y X Translate x:=x+1

Y X

Y Scale x:=x*2 X X

x:=x+1

Diagram 2.5: The order in which transformations are applied is significant

Computer Graphics Lecture 2: 3D objects and projections

Page: 3

Rotation has to be treated differently since we need to specify an axis. The matrices for rotation about the three Cartesian axes are:
Rx = 1 0 0 0 Cos() -Sin() 0 0 0 Cos() -Sin() 0 Sin() Cos() 0 0 0 Sin() Cos() 0 0 0 1 0 0 0 0 1 0 0 0 1 Ry = Cos() 0 Sin() 0 0 1 0 0 -Sin() 0 Cos() 0 0 0 0 1

Rz =

Some care is required with the signs. The above formulation obeys the conventions of a left hand axis system. That is, if the positive y-axis is taken as vertical, and the positive x-axis horizontal to the right, the positive z-axis is into the page. In these cases, rotation is in a clockwise direction when viewed from the positive side of the axis, or vice versa, anti-clockwise when viewed from the negative side of the axis. The derivation of the Rz matrix is shown in Diagram 2.6 the others may be proved similarly.
Y
[X', Y'] Rotate by [X,Y] = [r Cos, r Sin] [X',Y'] = [ r Cos(+) , r Sin(+) ] = [ r Cos Cos - rSin Sin, rSinCos + rCosSin ] = [ X Cos -Y Sin, YCos + XSin] =[X Y] Cos Sin -Sin Cos

[X,Y]

X
Diagram 2.6: Derivation of the Rotation Matrix

Inversions of these matrices can be computed easily, without recourse to Gaussean elimination, by considering the meaning of each transformation. For scaling, we substitute 1/sx for sx, 1/ sy for sy and 1/ sz for sz to invert the scaling. For translation we substitute -tx for tx, - ty for ty and - tz for tz. For the rotation matrices we note that: Cos(-) = Cos() and Sin(-) = -Sin() Hence to invert the matrix we simply change the sign of the Sin terms.

Computer Graphics Lecture 2: 3D objects and projections

Page: 4

You might also like