0% found this document useful (0 votes)
55 views

3-D Transformations

3D computer graphics uses an additional dimension of depth compared to 2D graphics, allowing more realistic 3D object representations. There are two common 3D coordinate systems that differ in the orientation of the Z-axis. Transformations like translation, scaling, and rotation that are used in 2D can be extended to 3D using 4x4 matrices. Multiple transformations can be combined by multiplying the corresponding matrices from right to left.

Uploaded by

Varchasva Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

3-D Transformations

3D computer graphics uses an additional dimension of depth compared to 2D graphics, allowing more realistic 3D object representations. There are two common 3D coordinate systems that differ in the orientation of the Z-axis. Transformations like translation, scaling, and rotation that are used in 2D can be extended to 3D using 4x4 matrices. Multiple transformations can be combined by multiplying the corresponding matrices from right to left.

Uploaded by

Varchasva Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 25

Computer Graphics

3D Transformations

1
3D Coordinate System
• 3D computer graphics involves the additional dimension of
depth, allowing more realistic representations of 3D objects in
the real world

• There are two possible ways of “attaching” the Z-axis, which


gives rise to a left-handed or a right-handed system

2
3D Transformation
• The translation, scaling and rotation transformations used for 2D can be
extended to three dimensions

• In 3D, each transformation is represented by a 4x4 matrix

• Using homogeneous coordinates it is possible to represent each type of


transformation in a matrix form and integrate transformations into one
matrix

• To apply transformations, simply multiply matrices, also easier in


hardware and software implementation

• Homogeneous coordinates can represent directions

• Homogeneous coordinates also allow for non-affine transformations, e.g.,


perspective projection
3
4
Matrix Representation: 2-D Transformations
Basic Transformations
 x   1 0 t x   x 
Translation  y   0 1 t   y 
P’=TP    y  
 1  0 0 1   1 
 x   cos  sin  0  x 
Rotation [O]  y    sin  cos   
P’=RP    0  y 
 1   0 0 1  1 
 x    sx 0 0  x 
Scaling [O]  y    0 s 0  y 
P’=SP    y  
 1   0 0 1  1  5
Translation

original

V=(tx i + ty j + tz k) == (tx, ty, tz)


translation along y,
or V = (0, k, 0)
Translation (55,60)

(20,35,10)
x  x  t x
y  y  t y
(45,30, 18)
(65,30,20)
z '  z  tz

(10,5, 8) (30,5, 10)


Just assume (not actual 3-D image )
The vector (tx, ty, tz,) is called the offset vector.

7
Scaling

Original scale all axes scale Y axis offset from origin

8
Rotation: Rotating in 3D
• Cannot do mindless conversion like before
• Why?
• Rotate about what axis?
• 3D rotation: about a defined axis
• Different Xform matrix for:
• Rotation about x-axis
• Rotation about y-axis
• Rotation about z-axis

• In general, rotations are specified by a rotation axis and


an angle. In 2-D, there is only one choice of rotation
axis that leaves points in the plane.

9
Rotating in 3D
• New terminology
• X-roll: rotation about x-axis
• Y-roll: rotation about y-axis
• Z-roll: rotation about z-axis
• Which way is +ve rotation
• Look in –ve direction (into +ve arrow)
• CCW is +ve rotation

+ x
z

10
3D Rotation

 The easiest rotation axes are those that parallel to the


coordinate axis.
Positive rotation angle produce counter clockwise rotations
about a coordinate axis, if we are looking along the positive
half of the axis towards the coordinate origin.

11
Fig: 3D Rotation
Coordinate

Axis Rotations
Obtain rotations around other axes through cyclic
permutation of coordinate parameters:

Write y in place of x, z in place of y and x in place of z, for


rotation around x axis.

Fig: Coordinate axis rotation 12


Coordinate Axis Rotations

Fig: Z-axis rotation 13


Coordinate

Axis Rotations
X- axis rotation:

x'  x
y '  y cos θ  z sin θ
z '  y sin θ  z cos θ

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

Fig: X-axis rotation 14


Coordinate Axis Rotations
.

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

Fig: Y-axis rotation 15


Reflection
• Reflection in computer graphics is used to emulate
reflective objects like mirrors and shiny surfaces
• Reflection may be an x-axis, y-axis, z-axis, and also in the
planes xy-plane, yz-plane, and zx-plane.
• Reflection relative to a given axis are equivalent to 180
degree rotations.

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

Fig: Reflection 16
3D Reflection

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

17
3D Reflection

x '  x cos θ  z sin θ


y' y
z '   x sin θ  z cos θ

18
Shearing
• A Transformation that distorts the shape of an object such
that the transformed shape appears as if the object were
decomposed of internal layers that had been caused to slide
over each other is called a shearing
• In 2-D, transformations relative to X or Y axis to produce
distortion in the shapes of objects. In 3-D, we can also
generate shears relative to Z-axis.

19
Shearing
• Modify object shapes
• Useful for perspective projection:
• Draw a cube (3D) on a screen (2D)
• Alter the values of x and y by an amount proportional to the
distance from Z ref.
• Shearing factors: Shx, Shy, Shz

20
Shearing
•Shearing along x-axis: only change with y and z coordinate

21
Shearing
•Shearing along y-axis: only change with x and z coordinate

22
Shearing
•Shearing along z-axis: only change with x and y coordinate

23
Composite 3D Transformations
 Same way as in two dimensions:
 Multiply matrices
 Rightmost term in matrix product is the first
transformation to be applied

24
.

Thank You

25

You might also like