![Page 1: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/1.jpg)
Viewpoints and Transformations
CSIS 5838: Graphics and Animation for Gaming
![Page 2: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/2.jpg)
Coordinate Systems
• Object Space: Coordinate space of an individual mesh– Edit mode in Blender
• Translating/rotating/scaling in this space changes location of individual vertices in this coordinate system– Usually with respect to some “object center”
Howard Hamilton, University of Regina
![Page 3: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/3.jpg)
Coordinate Systems
• World Space: Overall coordinate space of all elements– Object mode in Blender
• Translating/rotating/scaling object in this space changes object space relative to world space– “Object center” manipulated– All vertices move with center
Howard Hamilton, University of Regina
![Page 4: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/4.jpg)
Coordinate Systems
• Image Space: Coordinate system from POV of viewer/camera– Camera view in Blender
• Convention: Center of Interest (COI) along z-axis in this space• Moving camera/viewpoint changes this space relative to
world space
Howard Hamilton, University of Regina
![Page 5: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/5.jpg)
Affine Transformations
• Transformation between coordinate systems using matrix multiplication
• General affine transformation of point (x, y, z) in one coordinate system to (x’, y’, z’) in another coordinate system:
![Page 6: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/6.jpg)
Translation and Scaling
• Translation by [p, q, r]:
• Scaling by [p, q, r]:
![Page 7: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/7.jpg)
Rotation About Different Axes
• By α around x-axis:
• By α around x-axis:
• By α around z-axis:
![Page 8: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/8.jpg)
Combined Transformations
• Can combine all transformation into single matrix with multiplication
• Mobj2world = Mobjtrans x Mobjscale x MobjrotX x MobjrotY x MobjrotZ
• Mworld2eye = Mworldtrans x Mworldscale x MworldrotX x MworldrotY x MworldrotZ
• Mobj2eye = Mobj2world x Mworld2eye
• Efficiency:– Compute Mobj2world for each object
– Compute Mworld2eye once for entire world
– Compute Mobj2eye for each object
– Apply Mobj2eye to each vertex in each object
![Page 9: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/9.jpg)
The Rendering Pipeline
• Conversion of vertices, etc. on mesh in object space to world space
• Projection of points in 3D world space into 2D image space
• Other modifiers– Surface features (colors, UV images etc.)– Transformation of apparent surfaces (smoothing,
etc.)– …
![Page 10: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/10.jpg)
Visual Frustum
• Area of world rendered to screen (“field of view”)• Near clip plane = image plane
(where image “projected”)• Far clip plane = limit of view– Nothing further from camera
rendered– Also nothing outside of
“cone” rendered
![Page 11: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/11.jpg)
Orthographic vs. Perspective View
• Projecting vertices in 3D image space to 2D image plane• Orthographic view:
(x, y, z) in image space (x, y) on image plane– No foreshortening– Makes editing objects simpler
blender.org
![Page 12: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/12.jpg)
Perspective View
• “Normal” vision with foreshortening• Image projected to point representing location of viewer• Focal length f =
distance between viewer and image plane– Smaller f = more foreshortening
blender.org
![Page 13: Viewpoints and Transformations CSIS 5838: Graphics and Animation for Gaming](https://reader036.vdocument.in/reader036/viewer/2022081504/5697c0211a28abf838cd28b6/html5/thumbnails/13.jpg)
Perspective Transformation
• Foreshortening:(x, y, z) in image space (xf/z, yf/z) on image plane
gamedev.com