Political Scandals, Elite Resistance, Leadershp Von Luebke 2010
Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke &...
-
date post
20-Jan-2016 -
Category
Documents
-
view
221 -
download
0
Transcript of Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke &...
![Page 1: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/1.jpg)
Welcome toCSc 830 Advanced Computer Graphics
By Ilmi Yoon
Based on Lecture note from David Luebke & Pradondet Nilagupta
![Page 2: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/2.jpg)
Where We’re GoingToday’s lectures:
Mathematical Foundations The graphics pipeline: the big picture Rigid-body transforms Homogeneous coordinates The viewing transform The projection transform
![Page 3: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/3.jpg)
Mathematical Foundations
FvD appendix gives good reviewI’ll give a brief, informal review of some of the
mathematical tools we’ll employ Geometry (2D, 3D) Trigonometry Vector and affine spaces
• Points, vectors, and coordinates Dot and cross products Linear transforms and matrices
![Page 4: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/4.jpg)
2D GeometryKnow your high-school geometry:
Total angle around a circle is 360° or 2π radians When two lines cross:
• Opposite angles are equivalent
• Angles along line sum to 180° Similar triangles:
• All corresponding angles are equivalent
• Corresponding pairs of sides have the same length ratio and are separated by equivalent angles
• Any corresponding pairs of sides have same length ratio
![Page 5: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/5.jpg)
Trigonometry
Sine: “opposite over hypotenuse”Cosine: “adjacent over hypotenuse”Tangent: “opposite over adjacent”Unit circle definitions:
sin () = x cos () = y tan () = x/y Etc…
(x, y)
![Page 6: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/6.jpg)
3D GeometryTo model, animate, and render 3D scenes, we
must specify: Location Displacement from arbitrary locations Orientation
We’ll look at two types of spaces: Vector spaces Affine spaces
We will often be sloppy about the distinction
![Page 7: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/7.jpg)
Vector SpacesTwo types of elements:
Scalars (real numbers): … Vectors (n-tuples): u, v, w, …
Supports two operations: Addition operation u + v, with:
• Identity 0 v + 0 = v• Inverse - v + (-v) = 0
Scalar multiplication:• Distributive rule: (u + v) = (u) + (v)
( + )u = u + u
![Page 8: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/8.jpg)
Vector SpacesA linear combination of vectors results in a new vector:
v = 1v1 + 2v2 + … + nvn
If the only set of scalars such that
1v1 + 2v2 + … + nvn = 0
is 1 = 2 = … = 3 = 0
then we say the vectors are linearly independent The dimension of a space is the greatest number of linearly
independent vectors possible in a vector set For a vector space of dimension n, any set of n linearly
independent vectors form a basis
![Page 9: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/9.jpg)
Vector Spaces: A Familiar ExampleOur common notion of vectors in a 2D plane is
(you guessed it) a vector space: Vectors are “arrows” rooted at the origin Scalar multiplication “streches” the arrow, changing
its length (magnitude) but not its direction Addition uses the “trapezoid rule”:
u+vy
xu
v
![Page 10: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/10.jpg)
Vector Spaces: Basis Vectors
Given a basis for a vector space: Each vector in the space is a unique linear
combination of the basis vectors The coordinates of a vector are the scalars from
this linear combination Best-known example: Cartesian coordinates
• Draw example on the board Note that a given vector v will have different
coordinates for different bases
![Page 11: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/11.jpg)
Vectors And PointWe commonly use vectors to represent:
Points in space (i.e., location) Displacements from point to point Direction (i.e., orientation)
But we want points and directions to behave differently Ex: To translate something means to move it without
changing its orientation Translation of a point = different point Translation of a direction = same direction
![Page 12: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/12.jpg)
Affine SpacesTo be more rigorous, we need an explicit notion of
position Affine spaces add a third element to vector spaces:
points (P, Q, R, …)Points support these operations
Point-point subtraction: Q - P = v• Result is a vector pointing from P to Q
Vector-point addition: P + v = Q• Result is a new point
Note that the addition of two points is not definedP
Q
v
![Page 13: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/13.jpg)
Affine SpacesPoints, like vectors, can be expressed in
coordinates The definition uses an affine combination Net effect is same: expressing a point in terms of a
basis
Thus the common practice of representing points as vectors with coordinates (see FvD)
Analogous to equating points and integers in C Be careful to avoid nonsensical operations
![Page 14: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/14.jpg)
Affine Lines: An Aside
Parametric representation of a line with a direction vector d and a point P1 on the line:
P() = Porigin + d
Restricting 0 produces a raySetting d to P - Q and restricting 0 1
produces a line segment between P and Q
![Page 15: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/15.jpg)
Dot ProductThe dot product or, more generally, inner product of
two vectors is a scalar:v1 • v2 = x1x2 + y1y2 + z1z2 (in 3D)
Useful for many purposes Computing the length of a vector: length(v) = sqrt(v • v)
Normalizing a vector, making it unit-length Computing the angle between two vectors:
u • v = |u| |v| cos(θ) Checking two vectors for orthogonality Projecting one vector onto another
θu
v
![Page 16: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/16.jpg)
Cross Product
The cross product or vector product of two vectors is a vector:
The cross product of two vectors is orthogonal to both
Right-hand rule dictates direction of cross product
1221
1221
1221
21 )(
y x y x
z x z x
z y z y
vv
![Page 17: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/17.jpg)
Linear Transformations
A linear transformation: Maps one vector to another Preserves linear combinations
Thus behavior of linear transformation is completely determined by what it does to a basis
Turns out any linear transform can be represented by a matrix
![Page 18: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/18.jpg)
Matrices
By convention, matrix element Mrc is located at row r and column c:
By (OpenGL) convention, vectors are columns:
mnm2m1
2n2221
1n1211
MMM
MMM
MMM
M
3
2
v
v
v
v
1
![Page 19: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/19.jpg)
Matrices
Matrix-vector multiplication applies a linear transformation to a vector:
Recall how to do matrix multiplication
z
y
x
v
v
v
MMM
MMM
MMM
vM
333231
232221
131211
![Page 20: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/20.jpg)
Matrix Transformations
A sequence or composition of linear transformations corresponds to the product of the corresponding matrices Note: the matrices to the right affect vector first Note: order of matrices matters!
The identity matrix I has no effect in multiplication
Some (not all) matrices have an inverse:
vvMM 1
![Page 21: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/21.jpg)
3-D Graphics: A Whirlwind Tour
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 22: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/22.jpg)
The Display You Know
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 23: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/23.jpg)
The Framebuffer You Know
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 24: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/24.jpg)
The Rendering Pipeline
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
Why do we call it a pipeline?
![Page 25: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/25.jpg)
2-D Rendering You Know
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 26: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/26.jpg)
The Rendering Pipeline: 3-D
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 27: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/27.jpg)
The Rendering Pipeline: 3-D
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem
• Vertices shaded according to lighting modelVertices shaded according to lighting model
• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem
• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
![Page 28: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/28.jpg)
The Rendering Pipeline: 3-DScene graph
Object geometry
LightingCalculations
Clipping
Result:Result:
• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem
• Vertices shaded according to lighting modelVertices shaded according to lighting model
• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem
• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
ModelingTransforms
ViewingTransform
ProjectionTransform
![Page 29: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/29.jpg)
Rendering: Transformations
So far, discussion has been in screen spaceBut model is stored in model space
(a.k.a. object space or world space)Three sets of geometric transformations:
Modeling transforms Viewing transforms Projection transforms
![Page 30: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/30.jpg)
Rendering: Transformations
Modeling transforms Size, place, scale, and rotate objects parts of the
model w.r.t. each other Object coordinates world coordinates
Z
X
Y
X
Z
Y
![Page 31: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/31.jpg)
Rendering: Transformations
Viewing transform Rotate & translate the world to lie directly in
front of the camera• Typically place camera at origin
• Typically looking down -Z axis World coordinates view coordinates
![Page 32: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/32.jpg)
Rendering: Transformations
Projection transform Apply perspective foreshortening
• Distant = small: the pinhole camera model View coordinates screen coordinates
![Page 33: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/33.jpg)
Rendering: TransformationsAll these transformations involve shifting
coordinate systems (i.e., basis sets)That’s what matrices do…Represent coordinates as vectors, transforms as
matrices
Multiply matrices = concatenate transforms!
y
x
y
x
cossin
sincos
'
'
![Page 34: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/34.jpg)
Rendering: Transformations
Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector Denoted [x, y, z, w]
• Note that typically w = 1 in model coordinates To get 3-D coordinates, divide by w:
[x’, y’, z’] = [x/w, y/w, z/w]
Transformations are 4x4 matricesWhy? To handle translation and projection
![Page 35: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/35.jpg)
Rendering: Transformations
OpenGL caveats: All modeling transforms and the viewing
transform are concatenated into the modelview matrix
A stack of modelview matrices is kept The projection transform is stored separately in
the projection matrix
See Chapter 3 of the OpenGL book
![Page 36: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/36.jpg)
The Rendering Pipeline: 3-D
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem
• Vertices shaded according to lighting modelVertices shaded according to lighting model
• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem
• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
![Page 37: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/37.jpg)
Rendering: Lighting
Illuminating a scene: coloring pixels according to some approximation of lighting Global illumination: solves for lighting of the
whole scene at once Local illumination: local approximation,
typically lighting each polygon separately
Interactive graphics (e.g., hardware) does only local illumination at run time
![Page 38: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/38.jpg)
The Rendering Pipeline: 3-D
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• All vertices of scene in shared 3-D “world” coordinate All vertices of scene in shared 3-D “world” coordinate systemsystem
• Vertices shaded according to lighting modelVertices shaded according to lighting model
• Scene vertices in 3-D “view” or “camera” coordinate Scene vertices in 3-D “view” or “camera” coordinate systemsystem
• Exactly those vertices & portions of polygons in view Exactly those vertices & portions of polygons in view frustumfrustum
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
![Page 39: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/39.jpg)
Rendering: Clipping
Clipping a 3-D primitive returns its intersection with the view frustum:
See Foley & van Dam section 19.1
![Page 40: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/40.jpg)
Rendering: Clipping
Clipping is tricky!
In: 3 verticesIn: 3 verticesOut: 6 verticesOut: 6 vertices
Clip
Clip In: 1 polygonIn: 1 polygonOut: 2 polygonsOut: 2 polygons
![Page 41: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/41.jpg)
The Rendering Pipeline: 3-D
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 42: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/42.jpg)
Modeling: The Basics
Common interactive 3-D primitives: points, lines, polygons (i.e., triangles)
Organized into objects Collection of primitives, other objects Associated matrix for transformations
Instancing: using same geometry for multiple objects 4 wheels on a car, 2 arms on a robot
![Page 43: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/43.jpg)
Modeling: The Scene Graph
The scene graph captures transformations and object-object relationships in a DAG
Objects in black; blue arrows indicate instancing and each have a matrix
Robot
BodyHead
ArmTrunkLegEyeMouth
![Page 44: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/44.jpg)
Modeling: The Scene Graph
Traverse the scene graph in depth-first order, concatenating transformations
Maintain a matrix stack of transformations
ArmTrunkLegEyeMouth
Head Body
Robot
Foot
MatrixMatrixStackStack
VisitedVisited
UnvisitedUnvisited
ActiveActive
![Page 45: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/45.jpg)
Modeling: The Camera
Finally: need a model of the virtual camera Can be very sophisticated
• Field of view, depth of field, distortion, chromatic aberration…
Interactive graphics (OpenGL):• Pinhole camera model
– Field of view
– Aspect ratio
– Near & far clipping planes
• Camera pose: position & orientation
![Page 46: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/46.jpg)
Modeling: The Camera
These parameters are encapsulated in a projection matrix Homogeneous coordinates 4x4 matrix! See OpenGL Appendix F for the matrix
The projection matrix premultiplies the viewing matrix, which premultiplies the modeling matrices Actually, OpenGL lumps viewing and modeling
transforms into modelview matrix
![Page 47: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/47.jpg)
Rigid-Body Transforms
Goal: object coordinatesworld coordinates
Idea: use only transformations that preserve the shape of the object Rigid-body or Euclidean transforms Includes rotation, translation, and scale
To reiterate: we will represent points as column vectors:
z
y
x
zyx ),,(
![Page 48: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/48.jpg)
Vectors and Matrices
Vector algebra operations can be expressed in this matrix form Dot product:
Cross product:• Note: use
right-handrule!
z
y
x
zyx
b
b
b
aaaba
0cb
0ca
cba
z
y
x
z
y
x
xy
xz
yz
c
c
c
b
b
b
aa
aa
aa
0
0
0
![Page 49: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/49.jpg)
TranslationsFor convenience we usually describe objects in relation to
their own coordinate system Solar system example
We can translate or move points to a new position by adding offsets to their coordinates:
Note that this translates all points uniformly
z
y
x
t
t
t
z
y
x
z
y
x
'
'
'
![Page 50: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/50.jpg)
2-D Rotation
(x, y)
(x’, y’)
x’ = x cos() - y sin()y’ = x sin() + y cos()
(Draw it)
![Page 51: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/51.jpg)
2-D Rotations
Rotations in 2-D are easy:
3-D is more complicated Need to specify an axis of rotation Common pedagogy: express rotation about this axis
as the composition of canonical rotations• Canonical rotations: rotation about X-axis, Y-axis, Z-axis
y
x
y
x
cossin
sincos
'
'
![Page 52: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/52.jpg)
3-D RotationsBasic idea:
Using rotations about X, Y, Z axes, rotate model until desired axis of rotation coincides with Z-axis
Perform rotation in the X-Y plane (i.e., about Z-axis) Reverse the initial rotations to get back into the initial
frame of reference
Objections: Difficult & error prone Ambiguous: several combinations about the canonical
axis give the same result
![Page 53: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/53.jpg)
ScalingScaling a coordinate means multiplying each of
its components by a scalarUniform scaling means this scalar is the same for
all components:
2
![Page 54: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/54.jpg)
Scaling
Non-uniform scaling: different scalars per component:
How can we represent this in matrix form?
X 2,Y 0.5
![Page 55: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/55.jpg)
Scaling
Scaling operation:
Or, in matrix form:
cz
by
ax
z
y
x
'
'
'
z
y
x
c
b
a
z
y
x
00
00
00
'
'
'
scaling matrix
![Page 56: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/56.jpg)
2-D Rotation
This is easy to capture in matrix form:
3-D is more complicated Need to specify an axis of rotation Simple cases: rotation about X, Y, Z axes
y
x
y
x
cossin
sincos
'
'
![Page 57: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/57.jpg)
3-D Rotation
What does the 3-D rotation matrix look like for a rotation about the Z-axis? Build it coordinate-by-coordinate
z
y
x
z
y
x
100
0)cos()sin(
0)sin()cos(
'
'
'
![Page 58: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/58.jpg)
3-D Rotation
What does the 3-D rotation matrix look like for a rotation about the Y-axis? Build it coordinate-by-coordinate
z
y
x
z
y
x
)cos(0)sin(
010
)sin(0)cos(
'
'
'
![Page 59: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/59.jpg)
3-D Rotation
What does the 3-D rotation matrix look like for a rotation about the X-axis? Build it coordinate-by-coordinate
z
y
x
z
y
x
)cos()sin(0
)sin()cos(0
001
'
'
'
![Page 60: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/60.jpg)
3-D Rotation
General rotations in 3-D require rotating about an arbitrary axis of rotation
Deriving the rotation matrix for such a rotation directly is difficult But possible, see McMillan’s lectures
Standard approach: express general rotation as composition of canonical rotations Rotations about X, Y, Z
![Page 61: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/61.jpg)
Composing Canonical Rotations
Goal: rotate about arbitrary vector A by Idea: we know how to rotate about X,Y,Z So, rotate about Y by until A lies in the YZ
plane, Then rotate about X by until A coincides with +Z, Then rotate about Z by
Then reverse the rotation about X (by -) Then reverse the rotation about Y (by -)
![Page 62: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/62.jpg)
Composing Canonical RotationsFirst: rotating about Y by until A lies in YZ
Draw it…
How exactly do we calculate ? Project A onto XZ plane Find angle to X:
= -(90° - ) = - 90 °
Second: rotating about X by until A lies on ZHow do we calculate ?
![Page 63: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/63.jpg)
Composing Canonical Rotations
Why are we slogging through all this tedium?
A: Because you’ll have to do it on the test
![Page 64: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/64.jpg)
3-D Rotation Matrices
So an arbitrary rotation about A composites several canonical rotations together
We can express each rotation as a matrixCompositing transforms == multiplying matricesThus we can express the final rotation as the
product of canonical rotation matricesThus we can express the final rotation with a
single matrix!
![Page 65: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/65.jpg)
Compositing Matrices
So we have the following matrices:
p: The point to be rotated about A by Ry : Rotate about Y by
Rx : Rotate about X by
Rz : Rotate about Z by
Rx -1: Undo rotation about X by
Ry-1
: Undo rotation about Y by In what order should we multiply them?
![Page 66: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/66.jpg)
Compositing Matrices
Short answer: the transformations, in order, are written from right to left In other words, the first matrix to affect the
vector goes next to the vector, the second next to the first, etc.
So in our case:
p’ = Ry-1 Rx
-1 Rz Rx Ry p
![Page 67: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/67.jpg)
Rotation Matrices
Notice these two matrices:
Rx : Rotate about X by
Rx -1: Undo rotation about X by
How can we calculate Rx -1?
![Page 68: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/68.jpg)
Rotation Matrices
Notice these two matrices:
Rx : Rotate about X by
Rx -1: Undo rotation about X by
How can we calculate Rx -1?
Obvious answer: calculate Rx (-)
Clever answer: exploit fact that rotation matrices are orthonormal
![Page 69: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/69.jpg)
Rotation Matrices
Notice these two matrices:
Rx : Rotate about X by
Rx -1: Undo rotation about X by
How can we calculate Rx -1?
Obvious answer: calculate Rx (-)
Clever answer: exploit fact that rotation matrices are orthonormal
What is an orthonormal matrix?What property are we talking about?
![Page 70: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/70.jpg)
Rotation Matrices
Orthonormal matrix: orthogonal (columns/rows linearly
independent) Columns/rows sum to 1
The inverse of an orthogonal matrix is just its transpose:
jfc
ieb
hda
jih
fed
cba
jih
fed
cbaT1
![Page 71: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/71.jpg)
Translation Matrices?
We can composite scale matrices just as we did rotation matrices
But how to represent translation as a matrix?
Answer: with homogeneous coordinates
![Page 72: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/72.jpg)
Homogeneous Coordinates
Homogeneous coordinates: represent coordinates in 3 dimensions with a 4-vector
(Note that typically w = 1 in object coordinates)
w
z
y
x
wz
wy
wx
zyx
1
/
/
/
),,(
![Page 73: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/73.jpg)
Homogeneous Coordinates
Homogeneous coordinates seem unintuitive, but they make graphics operations much easier
Our transformation matrices are now 4x4:
1000
0)cos()sin(0
0)sin()cos(0
0001
xR
![Page 74: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/74.jpg)
Homogeneous Coordinates
Homogeneous coordinates seem unintuitive, but they make graphics operations much easier
Our transformation matrices are now 4x4:
1000
0)cos(0)sin(
0010
0)sin(0)cos(
yR
![Page 75: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/75.jpg)
Homogeneous Coordinates
Homogeneous coordinates seem unintuitive, but they make graphics operations much easier
Our transformation matrices are now 4x4:
1000
0100
00)cos()sin(
00)sin()cos(
zR
![Page 76: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/76.jpg)
Homogeneous Coordinates
Homogeneous coordinates seem unintuitive, but they make graphics operations much easier
Our transformation matrices are now 4x4:
1000
000
000
000
z
y
x
S
S
S
S
![Page 77: Welcome to CSc 830 Advanced Computer Graphics By Ilmi Yoon Based on Lecture note from David Luebke & Pradondet Nilagupta.](https://reader036.fdocuments.in/reader036/viewer/2022070415/56649d435503460f94a1e7af/html5/thumbnails/77.jpg)
Homogeneous Coordinates
How can we represent translation as a 4x4 matrix?
A: Using the rightmost column:
1000
000
000
000
z
y
x
T
T
T
T