3D Transformations

Document Sample

```					3D Graphics
Graphics
3D Graphics is about creating 3D scenes and
viewing them as 2D images – think about how
you take a picture using a camera
o 3D Modelling
o 3D Transformation
o Viewing
o Projection
o Graphics Pipeline refers to the steps to render
graphical objects (the overall process of going
from a 3D scene to a shaded projection on a 2D
surface
3D Graphics Pipeline
o Creating objects/scene – 3D modeling
o Define objects in local coordinate system
o Transform objects to world coordinate system
o Determining which part of the objects/scene are visible
o Camera (position, direction, focal length) to define viewing
volume
o Transform objects to camera coordinate system
o Project object to view plane to obtain 2D representation
o Clip against view volume to determine visible objects
o Determining which pixels should be filled
o Rasterization – from vectors/polygons to pixels
o Hidden Surface Removal - determine which object in the view volume
should appear in image at each pixel
o Determining what color/texture/lighting it is
o Lighting models and texture mapping
Viewing and Clipping
Projection
Polygonal Models
• The most common type of model used in 3D –
store faces of the object as planar polygons
• Each polygonal face may be represented by its
vertices or edges
• Physical properties of the object may also be
held as part of the representation, for example
colour, light, texture
• Representation methods such as this are called
Boundary Representations or B-reps. This
may also be used to approximate a curved
surface, by planar polygonal patches
3D Transformation

• The translation, scaling and rotation transformations
used for 2D can be extended to three dimensions
• Using homogeneous coordinates it is possible to
represent each type of transformation in a matrix
form and integrate transformations into one matrix
• Homogeneous coordinates also allow for non-affine
transformations, e.g., perspective projection
• To apply transformations, simply multiply matrices,
also easier in hardware and software implementation
Homogeneous Coordinates

• Basis of the homogeneous co-ordinate system is
the set of n basis vectors and the origin position
• All points and vectors are therefore compactly
represented using their coordinates:

• 3D Transformations 4 x 4 Homogeneous co-
ordinates
Translation
• Translation only applies to points, never
translate vectors
• Remember: points have homogeneous
co-ordinate w = 1
Composing Transformations
• translation

1     dx1
                                       
1     dx 2
T1  T(dx1,dy1)   1   dy1                               
1

dy 2
   1               T2  T(dx 2,dy 2)  
                                          1     
      1                                         
      1 
P'' T2  P' T2 [T1 P]  [T2  T1] P,where

1        dx1  dx 2
                  
1      dy1  dy 2
T2  T1                                   so translations add
     1            
                  
            1 
Translation
Scale
Scale
We would also like to scale points thus we need a homogeneous
transformation for consistency:
Scale
all vectors are scaled from the origin:
Rotation
all vectors are scaled from the origin:

cos          sin         0   0
 sin        cos           0   0
Rotationz                                   
 0             0            1   0
                                 
 0             0            0   1

 cos         0     sin        0
 0            1         0       0
Rotationy                                   
 sin        0 cos            0
                                 
 0            0         0       1

1         0          0           0
0    cos           sin        0
Rotationx                                    
0    sin          cos          0
                                  
0         0          0           1
Rotation
Transformation Composition
Transformation Composition

• Rotation in XY plane by q degrees anti-
clockwise (round about original point)
Viewing 3D World on 2D plane

• To view 3D, need to project points onto 2D view plane
• Scene or view volume
• Window: projection plane
• Viewport: display plane
• Projection: intersection of projectors w/window
• Center of projection: focal point for all projectors
3D                    2D Projection
•   We need to transform from a special viewing coordinate system (camera on
z-axis pointing along the axis) into a projection coordinate
• Type of projection depends on a number of factors:
– location and orientation of the viewing plane (viewport)
– direction of projection (described by a vector)
– projection type:
Parallel Projection

•   In parallel projection, the observer position is at an infinite distance, so the
projection lines are considered parallel
Parallel Projections
Perspective Projection

•   In a perspective projection, object positions are projected onto the view
plane along lines which converge at the observer, or Centre of Projection
(COP)

•   Perspective projection gives realistic views, but does not preserve
proportions - projections of distant objects are smaller than projections of
objects of the same size which are closer to the view plane (foreshortening
Perspective Projections
Perspective Projection

```
DOCUMENT INFO
Shared By:
Categories:
Stats:
 views: 89 posted: 2/22/2010 language: English pages: 25