3D Computer Graphics An oh so brief introduction.
-
Upload
kathlyn-walters -
Category
Documents
-
view
219 -
download
2
Transcript of 3D Computer Graphics An oh so brief introduction.
![Page 1: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/1.jpg)
3D Computer Graphics
An oh so brief introduction
![Page 2: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/2.jpg)
What you need to know…
• There’s really only a couple of things– Coordinate systems– Matrices– 3D → 2D transformation
![Page 3: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/3.jpg)
Homogeneous Coordinates
A computational convenience
![Page 4: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/4.jpg)
Coordinate systems
• To represent a location (point) in 3D space one needs 3 numbers
(X, Y, Z)
• Each value specifies a distance along the respective coordinate axis
• The resultant location (point) is the sum of the axis unit vectors multiplied by the values
![Page 5: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/5.jpg)
Manipulating points
• As we will see soon, manipulations of points in 3 space are generally performed using matrix notation
• But, as it turns out, this is not readily done using points represented by 3 values
• Something better is needed…
![Page 6: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/6.jpg)
Homogeneous coordinates
• Homogeneous coordinates were introduced as a means of facilitating matrix-based transformations applied to points
• It is a 4D representation of a 3D point
(X, Y, Z) → (X, Y, Z, 1.0)
(X/W, Y/W, Z/W) → (X, Y, Z, W)• That’s really all you need to know about
homogeneous coordinates
![Page 7: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/7.jpg)
Matrix Operations
Uses of Matrix Multiplication
![Page 8: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/8.jpg)
Translation
• To move a point (X, Y, Z) by amounts (x, y, z):
0.1'''
0.10.10.00.00.0
0.10.00.0
0.00.10.0
0.00.00.1
ZYXZ
Y
X
z
y
x
![Page 9: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/9.jpg)
Scale
• To “scale” a point (X, Y, Z) by sizes (x, y, z):
0.1'''
0.10.10.00.00.0
0.00.00.0
0.00.00.0
0.00.00.0
ZYXZ
Y
X
z
y
x
![Page 10: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/10.jpg)
Rotate X
• To “rotate” a point (X, Y, Z) about the X axis by an angle Θ:
0.1'''
0.10.10.00.00.0
0.0)cos()sin(0.0
0.0)sin()cos(0.0
0.00.00.00.1
ZYXZ
Y
X
![Page 11: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/11.jpg)
Rotate Y
• To “rotate” a point (X, Y, Z) about the Y axis by an angle Θ:
0.1'''
0.10.10.00.00.0
0.0)cos(0.0)sin(
0.00.00.10.0
0.0)sin(0.0)cos(
ZYXZ
Y
X
![Page 12: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/12.jpg)
Rotate Z
• To “rotate” a point (X, Y, Z) about the Z axis by an angle Θ:
0.1'''
0.10.10.00.00.0
0.00.10.00.0
0.00.0)cos()sin(
0.00.0)sin()cos(
ZYXZ
Y
X
![Page 13: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/13.jpg)
Shear X
• To “shear” a point (X, Y, Z) int the X direction by an angle Θ:
0.1'''
0.10.10.00.00.0
0.00.10.00.0
0.00.00.10.0
0.00.0)tan(
0.10.1
ZYXZ
Y
X
![Page 14: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/14.jpg)
Shear Y
• To “shear” a point (X, Y, Z) in the Y direction by an angle Θ:
0.1'''
0.10.10.00.00.0
0.00.10.00.0
0.0)tan(
0.10.10.0
0.00.00.00.1
ZYXZ
Y
X
![Page 15: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/15.jpg)
Shear Z
• To “shear” a point (X, Y, Z) in the Z direction by an angle Θ:
0.1'''
0.10.10.00.00.0
0.00.10.0)tan(
0.10.00.00.10.0
0.00.00.00.1
ZYXZ
Y
X
![Page 16: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/16.jpg)
Combining matrices• Rotation about an arbitrary axis is performed by
combining matrices– Thus the need for homogeneous coordinates
– Axis is a unit vector from <0, 0, 0> to <Px, Py, Pz>
1000
100
010
001
PPP
z
y
x
Translate to origin
0.10.00.00.0
0.0)cos()sin(0.0
0.0)sin()cos(0.0
0.00.00.00.1
Rotate Θ about X
0.10.00.00.0
0.0)cos(0.0)sin(
0.00.00.10.0
0.0)sin(0.0)cos(
Rotate Θ about Y
0.10.00.00.0
0.00.10.00.0
0.00.0)cos()sin(
0.00.0)sin()cos(
Rotate Θ about Z
0.10.00.00.0
0.0)cos(0.0)sin(
0.00.00.10.0
0.0)sin(0.0)cos(
Rotate -Θ about Y
0.10.00.00.0
0.0)cos()sin(0.0
0.0)sin()cos(0.0
0.00.00.00.1
Rotate -Θ about X
1000
100
010
001
PPP
z
y
x
Translate to point
![Page 17: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/17.jpg)
Problems
• Rotation based on matrix operations [potentially] suffers some afflictions– Difficult to interpolate between rotations when you want to
create a smooth sequence – Gimbal lock – when one of the three axes rotates to align
with another essentially rendering it redundant (reduces the number of degrees of freedom)
– Non-linear speed of rotation – objects don’t rotate smoothly with constant velocity
• These afflictions are due to the use of Euler angles and trigonometric functions that don’t always behave well (sign changes at quadrant changes, asymptotic behavior)
![Page 18: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/18.jpg)
Quaterions
• Another method for performing rotations• Based on complex arithmetic (complex numbers –
not complicated numbers)• Straight forward conversion from Euler (matrix based)
operations to Quaternions• The underlying concepts are nasty• The implementation is easy
– Just a bunch of multiplications and additions• Handles the constant velocity rotation issue
– SLERP (Spherical LinEaR interPolation)– Ken Shoemake is credited for coming up with the approach
![Page 19: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/19.jpg)
3D → 2D Transformation
![Page 20: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/20.jpg)
Projections – Orthographic
• Projectors are perpendicular to the projection plane• Project plane is parallel to one of the principal faces
![Page 21: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/21.jpg)
Projections – Axonometric
• Projectors are perpendicular to the projection plane
• Project plane has any desired orientation with respect to the object faces
![Page 22: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/22.jpg)
Projections – Oblique
• Projectors are arbitrary with respect to the projection plane
![Page 23: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/23.jpg)
Projections – Perspective
• Projectors converge at the center of projection
![Page 24: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/24.jpg)
Projections
• Each has advantages and disadvantages dealing with– Retention of angles between lines– Retention of distances between points– Visibility of surfaces– Realization via camera models– Realistic synthesis of scenes
![Page 25: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/25.jpg)
Triangulation
Because you asked
![Page 26: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/26.jpg)
Triangulation
• Problem: given a set of points, find a set of triangles that connects those points in a mesh
• Solution: computational geometry provides us with the Voronoi Diagram and (it’s dual) the Delaunay Triangulation
![Page 27: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/27.jpg)
Delaunay Triangulation
• For a given set of points – Find a set of edges satisfying an "empty
circle" property: – for each edge we can find a circle
containing the edge's endpoints but not containing any other points
– Deals with
![Page 28: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/28.jpg)
Voronoi Diagram
• For a given set of points– Every point in the region around a point is
closer to that point than to any of the other point
![Page 29: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/29.jpg)
Inscribe and Circumscribe
• Inscribe– Given a triangle find
a circle that fits inside it
• Circumscribe– Given a triangle find
a circle that passes through all three vertices
triangle
inscribe
circumscribe
![Page 30: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/30.jpg)
Delaunay, circles, Voronoi
![Page 31: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/31.jpg)
Summary
• This is all stuff that is fundamental to computer graphics (with the possible exception of triangulation – that’s computational geometry)– Typical 1 semester undergraduate course
spends most of it’s time on these topics– Lots of good books on this material
![Page 32: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/32.jpg)
Bibliography
• Interactive Computer Graphics 4th edition– Angel– Addison-Wesley
• Computer Graphics Principles and Practice 2nd edition– Foley, van Dam, Feiner, Hughes– Addison-Wesley
• Java 2D Graphics– Knudsen– O’Reilly
• Computer Graphics for Java Programmers– Ammeraal– Wiley
![Page 33: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/33.jpg)
Bibliography
• Essential Mathematics for Games & Interactive Applications– van Verth, Bishop– Morgan Kaufmann
• Visualizing Quaternions– Hanson– Morgan Kaufmann
• 3D Game Engine Design– Eberly– Morgan Kaufmann
![Page 34: 3D Computer Graphics An oh so brief introduction.](https://reader035.fdocuments.us/reader035/viewer/2022062802/56649e8a5503460f94b8f8ec/html5/thumbnails/34.jpg)
Bibliography
• Game Physics– Eberly– Morgan Kaufmann
• Killer Game Programming in Java– Davison– O’Reilly
• Developing Games in Java– Brackeen, Barker, Vanhelsuwe– New Riders
• Software Engineering and Computer Games– Rucker– Addison-Wesley