Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering...
-
Upload
bryan-watts -
Category
Documents
-
view
236 -
download
10
Transcript of Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering...
![Page 1: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/1.jpg)
Introduction to Computer GraphicsCS 445 / 645
Lecture 6Lecture 6
Geometric primitives andGeometric primitives andthe rendering pipeplinethe rendering pipepline
Lecture 6Lecture 6
Geometric primitives andGeometric primitives andthe rendering pipeplinethe rendering pipeplineM.C. Escher – Smaller and Smaller (1956)
![Page 2: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/2.jpg)
Rendering geometric primitives
Describe objects with points, lines, and surfaces Describe objects with points, lines, and surfaces
• Compact mathematical notationCompact mathematical notation
• Operators to apply to those representationsOperators to apply to those representations
Render the objectsRender the objects
• The rendering pipelineThe rendering pipeline
Appendix A1-A5Appendix A1-A5
Describe objects with points, lines, and surfaces Describe objects with points, lines, and surfaces
• Compact mathematical notationCompact mathematical notation
• Operators to apply to those representationsOperators to apply to those representations
Render the objectsRender the objects
• The rendering pipelineThe rendering pipeline
Appendix A1-A5Appendix A1-A5
H&B Figure 109
![Page 3: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/3.jpg)
Rendering
Generate an image from geometric primitivesGenerate an image from geometric primitivesGenerate an image from geometric primitivesGenerate an image from geometric primitives
Rendering
Geometric Primitives
Raster Image
![Page 4: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/4.jpg)
3D Rendering Example
What issues must be addressed by a 3D rendering system?
![Page 5: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/5.jpg)
Overview
3D scene representation3D scene representation
3D viewer representation3D viewer representation
Visible surface determinationVisible surface determination
Lighting simulationLighting simulation
3D scene representation3D scene representation
3D viewer representation3D viewer representation
Visible surface determinationVisible surface determination
Lighting simulationLighting simulation
![Page 6: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/6.jpg)
Overview
3D scene representation3D scene representation
3D viewer representation3D viewer representation
Visible surface determinationVisible surface determination
Lighting simulationLighting simulation
3D scene representation3D scene representation
3D viewer representation3D viewer representation
Visible surface determinationVisible surface determination
Lighting simulationLighting simulation
How is the 3D scenedescribed in a computer?
How is the 3D scenedescribed in a computer?
![Page 7: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/7.jpg)
3D Scene Representation
Scene is usually approximated by 3D primitivesScene is usually approximated by 3D primitives
• PointPoint
• Line segmentLine segment
• PolygonPolygon
• PolyhedronPolyhedron
• Curved surfaceCurved surface
• Solid object Solid object
• etc.etc.
Scene is usually approximated by 3D primitivesScene is usually approximated by 3D primitives
• PointPoint
• Line segmentLine segment
• PolygonPolygon
• PolyhedronPolyhedron
• Curved surfaceCurved surface
• Solid object Solid object
• etc.etc.
![Page 8: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/8.jpg)
3D Point
Specifies a locationSpecifies a locationSpecifies a locationSpecifies a location
![Page 9: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/9.jpg)
3D Point
Specifies a locationSpecifies a location
• Represented by three coordinatesRepresented by three coordinates
• Infinitely smallInfinitely small
Specifies a locationSpecifies a location
• Represented by three coordinatesRepresented by three coordinates
• Infinitely smallInfinitely small
(x,y,z)
![Page 10: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/10.jpg)
3D Vector
Specifies a direction and a magnitudeSpecifies a direction and a magnitudeSpecifies a direction and a magnitudeSpecifies a direction and a magnitude
![Page 11: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/11.jpg)
3D Vector
Specifies a direction and a magnitudeSpecifies a direction and a magnitude
• Represented by three coordinatesRepresented by three coordinates
• Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)
• Has no locationHas no location
Specifies a direction and a magnitudeSpecifies a direction and a magnitude
• Represented by three coordinatesRepresented by three coordinates
• Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)Magnitude ||V|| = sqrt(dx dx + dy dy + dz dz)
• Has no locationHas no location(dx,dy,dz)
![Page 12: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/12.jpg)
Vector Addition/Subtraction
• operation operation u + vu + v, with:, with:
– Identity Identity 00 : : vv + + 00 = = v v
– Inverse Inverse -- : : vv + (- + (-vv) = ) = 00
• Addition uses the “parallelogram rule”:Addition uses the “parallelogram rule”:
• operation operation u + vu + v, with:, with:
– Identity Identity 00 : : vv + + 00 = = v v
– Inverse Inverse -- : : vv + (- + (-vv) = ) = 00
• Addition uses the “parallelogram rule”:Addition uses the “parallelogram rule”:
u+v
u
vu-v
uv
-v
-v
![Page 13: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/13.jpg)
Vector Space
Vectors define a vector spaceVectors define a vector space
• They support vector additionThey support vector addition
– Commutative and associativeCommutative and associative
– Possess identity and inversePossess identity and inverse
• They support scalar multiplicationThey support scalar multiplication
– Associative, distributiveAssociative, distributive
– Possess identityPossess identity
Vectors define a vector spaceVectors define a vector space
• They support vector additionThey support vector addition
– Commutative and associativeCommutative and associative
– Possess identity and inversePossess identity and inverse
• They support scalar multiplicationThey support scalar multiplication
– Associative, distributiveAssociative, distributive
– Possess identityPossess identity
![Page 14: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/14.jpg)
Affine Spaces
• Vector spaces lack position and distanceVector spaces lack position and distance
– They have magnitude and direction but no locationThey have magnitude and direction but no location
• Combine the point and vector primitivesCombine the point and vector primitives
– Permits describing vectors relative to a common locationPermits describing vectors relative to a common location
• A point and three vectors define a 3-D coordinate system A point and three vectors define a 3-D coordinate system
• Point-point subtraction yields a vectorPoint-point subtraction yields a vector
• Vector spaces lack position and distanceVector spaces lack position and distance
– They have magnitude and direction but no locationThey have magnitude and direction but no location
• Combine the point and vector primitivesCombine the point and vector primitives
– Permits describing vectors relative to a common locationPermits describing vectors relative to a common location
• A point and three vectors define a 3-D coordinate system A point and three vectors define a 3-D coordinate system
• Point-point subtraction yields a vectorPoint-point subtraction yields a vector
![Page 15: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/15.jpg)
Coordinate Systems
lGrasp z-axis with handlThumb points in direction of z-axis lRoll fingers from positive x-axis towards positive y-axis
![Page 16: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/16.jpg)
Points + Vectors
Points support these operationsPoints support these operations
• Point-point subtraction: Point-point subtraction: QQ - - PP = = vv
– Result is a vector pointing fromResult is a vector pointing from PP toto QQ
• Vector-point addition: Vector-point addition: PP + + vv = = QQ
– Result is a new pointResult is a new point
• Note that the addition of two points is not definedNote that the addition of two points is not defined
Points support these operationsPoints support these operations
• Point-point subtraction: Point-point subtraction: QQ - - PP = = vv
– Result is a vector pointing fromResult is a vector pointing from PP toto QQ
• Vector-point addition: Vector-point addition: PP + + vv = = QQ
– Result is a new pointResult is a new point
• Note that the addition of two points is not definedNote that the addition of two points is not defined
P
Q
v
![Page 17: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/17.jpg)
3D Line Segment
Linear path between two pointsLinear path between two pointsLinear path between two pointsLinear path between two points
![Page 18: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/18.jpg)
3D Line Segment
Use a linear combination of two pointsUse a linear combination of two points
• Parametric representation:Parametric representation:
– P = PP = P11 + t (P + t (P22 - P - P11), (0 ), (0 t t 1) 1)
Use a linear combination of two pointsUse a linear combination of two points
• Parametric representation:Parametric representation:
– P = PP = P11 + t (P + t (P22 - P - P11), (0 ), (0 t t 1) 1)
P1
P2
![Page 19: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/19.jpg)
3D Ray
Line segment with one endpoint at infinityLine segment with one endpoint at infinity
• Parametric representation: Parametric representation:
– P = PP = P11 + t V, (0 <= t < + t V, (0 <= t < ))
Line segment with one endpoint at infinityLine segment with one endpoint at infinity
• Parametric representation: Parametric representation:
– P = PP = P11 + t V, (0 <= t < + t V, (0 <= t < ))
P1
V
![Page 20: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/20.jpg)
3D Line
Line segment with both endpoints at infinityLine segment with both endpoints at infinity
• Parametric representation: Parametric representation:
– P = PP = P11 + t V, (- + t V, (- < t < < t < ))
Line segment with both endpoints at infinityLine segment with both endpoints at infinity
• Parametric representation: Parametric representation:
– P = PP = P11 + t V, (- + t V, (- < t < < t < ))
P1
V
![Page 21: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/21.jpg)
3D Line – Slope Intercept
Slope Slope =m =m
= rise / run= rise / run
Slope Slope = (y - y1) / (x - x1) = (y - y1) / (x - x1) = (y2 - y1) / (x2 - x1)= (y2 - y1) / (x2 - x1)
Solve for y:Solve for y:
y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1
or: y = mx + bor: y = mx + b
Slope Slope =m =m
= rise / run= rise / run
Slope Slope = (y - y1) / (x - x1) = (y - y1) / (x - x1) = (y2 - y1) / (x2 - x1)= (y2 - y1) / (x2 - x1)
Solve for y:Solve for y:
y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1y = [(y2 - y1)/(x2 - x1)]x + [-(y2-y1)/(x2 - x1)]x1 + y1
or: y = mx + bor: y = mx + b
x
y
P2 = (x2, y2)
P1 = (x1, y1)
P = (x, y)
![Page 22: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/22.jpg)
Euclidean Spaces
Q: What is the distance function between points Q: What is the distance function between points and vectors in affine space?and vectors in affine space?
A: Dot productA: Dot product
• Euclidean affine space = affine space plus dot productEuclidean affine space = affine space plus dot product
• Permits the computation of distance and anglesPermits the computation of distance and angles
Q: What is the distance function between points Q: What is the distance function between points and vectors in affine space?and vectors in affine space?
A: Dot productA: Dot product
• Euclidean affine space = affine space plus dot productEuclidean affine space = affine space plus dot product
• Permits the computation of distance and anglesPermits the computation of distance and angles
![Page 23: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/23.jpg)
Dot Product
• The The dot productdot product or, more generally, or, more generally, inner productinner product of of two vectors is a scalar:two vectors is a scalar:
vv11 • • vv22 = = xx11xx22 + + yy11yy22 + + zz11zz2 2 (in 3D)(in 3D)
• The The dot productdot product or, more generally, or, more generally, inner productinner product of of two vectors is a scalar:two vectors is a scalar:
vv11 • • vv22 = = xx11xx22 + + yy11yy22 + + zz11zz2 2 (in 3D)(in 3D)
u θ
v
![Page 24: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/24.jpg)
Dot Product
Useful for many purposesUseful for many purposes• Computing the length (Euclidean Norm) of a vector: Computing the length (Euclidean Norm) of a vector:
– lengthlength((vv) = ||) = ||vv|| = sqrt(|| = sqrt(v • v)v • v)
• NormalizingNormalizing a vector, making it unit-length: a vector, making it unit-length: v = v / ||v||v = v / ||v||
• Computing the angle between two vectors:Computing the angle between two vectors:
– u • v u • v = |= |uu| || |vv| cos(θ)| cos(θ)
• Checking two vectors for orthogonalityChecking two vectors for orthogonality
– u • v = 0.0u • v = 0.0
Useful for many purposesUseful for many purposes• Computing the length (Euclidean Norm) of a vector: Computing the length (Euclidean Norm) of a vector:
– lengthlength((vv) = ||) = ||vv|| = sqrt(|| = sqrt(v • v)v • v)
• NormalizingNormalizing a vector, making it unit-length: a vector, making it unit-length: v = v / ||v||v = v / ||v||
• Computing the angle between two vectors:Computing the angle between two vectors:
– u • v u • v = |= |uu| || |vv| cos(θ)| cos(θ)
• Checking two vectors for orthogonalityChecking two vectors for orthogonality
– u • v = 0.0u • v = 0.0 u θ
v
![Page 25: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/25.jpg)
ProjectingProjecting one vector onto another one vector onto another
• If If vv is a unit vector and we have another vector, is a unit vector and we have another vector, ww
• We can project We can project ww perpendicularly onto perpendicularly onto vv
• And the result,And the result, u u, has length , has length w w • • vv
ProjectingProjecting one vector onto another one vector onto another
• If If vv is a unit vector and we have another vector, is a unit vector and we have another vector, ww
• We can project We can project ww perpendicularly onto perpendicularly onto vv
• And the result,And the result, u u, has length , has length w w • • vv
Dot Product
u
w
v
wv
wv
wvw
wu
)cos(
![Page 26: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/26.jpg)
Dot Product
Is commutativeIs commutative
• u • v = v • uu • v = v • u
Is distributive with respect to additionIs distributive with respect to addition
• u • (v + w) = u • v + u • wu • (v + w) = u • v + u • w
Is commutativeIs commutative
• u • v = v • uu • v = v • u
Is distributive with respect to additionIs distributive with respect to addition
• u • (v + w) = u • v + u • wu • (v + w) = u • v + u • w
![Page 27: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/27.jpg)
Cross Product
The The cross productcross product or or vector productvector product of two vectors is a of two vectors is a vector:vector:
The cross product of two vectors is orthogonal to bothThe cross product of two vectors is orthogonal to both
Right-hand rule dictates direction of cross productRight-hand rule dictates direction of cross product
The The cross productcross product or or vector productvector product of two vectors is a of two vectors is a vector:vector:
The cross product of two vectors is orthogonal to bothThe cross product of two vectors is orthogonal to both
Right-hand rule dictates direction of cross productRight-hand rule dictates direction of cross product
1221
1221
1221
tdeterminan222
11121 )(
y x y x
z x z x
z y z y
zyx
zyx
uuu zyx
vv
![Page 28: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/28.jpg)
Cross Product Right Hand Rule See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
Twist your hand about the A-axis such that B extends perpendicularly from your palm
As you curl your fingers to make a fist, your thumb will point in the direction of the cross product
![Page 29: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/29.jpg)
Cross Product Right Hand Rule
See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
Twist your hand about the A-axis such that B extends perpendicularly from your palm
As you curl your fingers to make a fist, your thumb will point in the direction of the cross product
![Page 30: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/30.jpg)
Cross Product Right Hand Rule
l See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
l Twist your hand about the A-axis such that B extends perpendicularly from your palm
l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product
![Page 31: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/31.jpg)
Cross Product Right Hand Rule
l See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
l Twist your hand about the A-axis such that B extends perpendicularly from your palm
l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product
![Page 32: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/32.jpg)
Cross Product Right Hand Rule
l See: http://www.phy.syr.edu/courses/video/RightHandRule/index2.html
l Orient your right hand such that your palm is at the beginning of A and your fingers point in the direction of A
l Twist your hand about the A-axis such that B extends perpendicularly from your palm
l As you curl your fingers to make a fist, your thumb will point in the direction of the cross product
![Page 33: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/33.jpg)
Other helpful formulas
Length = sqrt (x2 - x1)Length = sqrt (x2 - x1)22 + (y2 - y1) + (y2 - y1)22
Midpoint, p2, between p1 and p3Midpoint, p2, between p1 and p3
• p2 = ((x1 + x3) / 2, (y1 + y3) / 2))p2 = ((x1 + x3) / 2, (y1 + y3) / 2))
Two lines are perpendicular if:Two lines are perpendicular if:
• M1 = -1/M2M1 = -1/M2
• cosine of the angle between them is 0cosine of the angle between them is 0
• Dot product = 0Dot product = 0
Length = sqrt (x2 - x1)Length = sqrt (x2 - x1)22 + (y2 - y1) + (y2 - y1)22
Midpoint, p2, between p1 and p3Midpoint, p2, between p1 and p3
• p2 = ((x1 + x3) / 2, (y1 + y3) / 2))p2 = ((x1 + x3) / 2, (y1 + y3) / 2))
Two lines are perpendicular if:Two lines are perpendicular if:
• M1 = -1/M2M1 = -1/M2
• cosine of the angle between them is 0cosine of the angle between them is 0
• Dot product = 0Dot product = 0
![Page 34: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/34.jpg)
3D Plane
A linear combination of three pointsA linear combination of three pointsA linear combination of three pointsA linear combination of three points
P1
P3P2
![Page 35: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/35.jpg)
Origin
3D Plane
A linear combination of three pointsA linear combination of three points
• Implicit representation: Implicit representation:
– ax + by + cz + d = 0, or ax + by + cz + d = 0, or
– P·N + d = 0P·N + d = 0
• N is the plane “normal”N is the plane “normal”
– Unit-length vectorUnit-length vector
– Perpendicular to planePerpendicular to plane
A linear combination of three pointsA linear combination of three points
• Implicit representation: Implicit representation:
– ax + by + cz + d = 0, or ax + by + cz + d = 0, or
– P·N + d = 0P·N + d = 0
• N is the plane “normal”N is the plane “normal”
– Unit-length vectorUnit-length vector
– Perpendicular to planePerpendicular to plane
P1
N = (a,b,c)
d
P3P2
![Page 36: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/36.jpg)
3D Sphere
All points at distance “r” from point “(cAll points at distance “r” from point “(cxx, c, cyy, c, czz)”)”
• Implicit representation:Implicit representation:
– (x - c(x - cxx))22 + (y - c + (y - cyy))22 + (z - c + (z - czz))22 = r = r 22
• Parametric representation:Parametric representation:
– x = r cos(x = r cos() cos() cos() + c) + cxx
– y = r cos(y = r cos() sin() sin() + c) + cyy
– z = r sin(z = r sin() + c) + czz
All points at distance “r” from point “(cAll points at distance “r” from point “(cxx, c, cyy, c, czz)”)”
• Implicit representation:Implicit representation:
– (x - c(x - cxx))22 + (y - c + (y - cyy))22 + (z - c + (z - czz))22 = r = r 22
• Parametric representation:Parametric representation:
– x = r cos(x = r cos() cos() cos() + c) + cxx
– y = r cos(y = r cos() sin() sin() + c) + cyy
– z = r sin(z = r sin() + c) + czz
r
![Page 37: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/37.jpg)
3D Geometric Primitives
More detail on 3D modeling later in course More detail on 3D modeling later in course
• PointPoint
• Line segmentLine segment
• PolygonPolygon
• PolyhedronPolyhedron
• Curved surfaceCurved surface
• Solid object Solid object
• etc.etc.
More detail on 3D modeling later in course More detail on 3D modeling later in course
• PointPoint
• Line segmentLine segment
• PolygonPolygon
• PolyhedronPolyhedron
• Curved surfaceCurved surface
• Solid object Solid object
• etc.etc.
H&B Figure 10.46
![Page 38: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/38.jpg)
Take a breath
We’re done with the primitivesWe’re done with the primitives
Now we’re moving on to study how graphics uses Now we’re moving on to study how graphics uses these primitives to make pretty picturesthese primitives to make pretty pictures
We’re done with the primitivesWe’re done with the primitives
Now we’re moving on to study how graphics uses Now we’re moving on to study how graphics uses these primitives to make pretty picturesthese primitives to make pretty pictures
![Page 39: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/39.jpg)
Rendering 3D Scenes
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 40: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/40.jpg)
Camera ModelsThe most common model is pin-hole camera The most common model is pin-hole camera
• All captured light rays arrive along paths toward focal point without lens distortion All captured light rays arrive along paths toward focal point without lens distortion (everything is in focus)(everything is in focus)
• Sensor response Sensor response proportional to radianceproportional to radiance
The most common model is pin-hole camera The most common model is pin-hole camera
• All captured light rays arrive along paths toward focal point without lens distortion All captured light rays arrive along paths toward focal point without lens distortion (everything is in focus)(everything is in focus)
• Sensor response Sensor response proportional to radianceproportional to radiance
Other models consider ...Depth of fieldMotion blurLens distortion
View plane
Eye position(focal point)
![Page 41: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/41.jpg)
Camera Parameters
What are the parameters of a camera?What are the parameters of a camera?What are the parameters of a camera?What are the parameters of a camera?
![Page 42: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/42.jpg)
Camera ParametersPositionPosition
• Eye position (px, py, pz)Eye position (px, py, pz)
OrientationOrientation
• View direction (dx, dy, dz)View direction (dx, dy, dz)
• Up direction (ux, uy, uz)Up direction (ux, uy, uz)
ApertureAperture
• Field of view (xfov, yfov)Field of view (xfov, yfov)
Film plane Film plane
• ““Look at” pointLook at” point
• View plane normalView plane normal
PositionPosition
• Eye position (px, py, pz)Eye position (px, py, pz)
OrientationOrientation
• View direction (dx, dy, dz)View direction (dx, dy, dz)
• Up direction (ux, uy, uz)Up direction (ux, uy, uz)
ApertureAperture
• Field of view (xfov, yfov)Field of view (xfov, yfov)
Film plane Film plane
• ““Look at” pointLook at” point
• View plane normalView plane normal
Eye Position
ViewPlane
“Look at”Point
![Page 43: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/43.jpg)
Moving the camera
View Frustum
Right
BackTowards
Up
![Page 44: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/44.jpg)
The Rendering Pipeline
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 45: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/45.jpg)
Rendering: Transformations
We’ve learned about transformationsWe’ve learned about transformations
But they are used in three ways:But they are used in three ways:
• Modeling transformsModeling transforms
• Viewing transforms (Move the camera)Viewing transforms (Move the camera)
• Projection transforms (Change the type of camera)Projection transforms (Change the type of camera)
We’ve learned about transformationsWe’ve learned about transformations
But they are used in three ways:But they are used in three ways:
• Modeling transformsModeling transforms
• Viewing transforms (Move the camera)Viewing transforms (Move the camera)
• Projection transforms (Change the type of camera)Projection transforms (Change the type of camera)
![Page 46: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/46.jpg)
The Rendering Pipeline: 3-D
Result:Result:
• All vertices of scene in shared 3-D “world” coordinate systemAll vertices of scene in shared 3-D “world” coordinate system
• Vertices shaded according to lighting modelVertices shaded according to lighting model
• Scene vertices in 3-D “view” or “camera” coordinate systemScene vertices in 3-D “view” or “camera” coordinate system
• Exactly those vertices & portions of polygons in view frustumExactly those vertices & portions of polygons in view frustum
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
Scene graphObject geometry
LightingCalculations
Clipping
ModelingTransforms
ViewingTransform
ProjectionTransform
![Page 47: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/47.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 systemAll vertices of scene in shared 3-D “world” coordinate system
![Page 48: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/48.jpg)
Rendering: Transformations
Modeling transformsModeling transforms
• Size, place, scale, and rotate objects and parts of the Size, place, scale, and rotate objects and parts of the model w.r.t. each othermodel w.r.t. each other
• Object coordinates -> world coordinatesObject coordinates -> world coordinates
Modeling transformsModeling transforms
• Size, place, scale, and rotate objects and parts of the Size, place, scale, and rotate objects and parts of the model w.r.t. each othermodel w.r.t. each other
• Object coordinates -> world coordinatesObject coordinates -> world coordinates
Z
X
Y
X
Z
Y
![Page 49: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/49.jpg)
The Rendering Pipeline: 3-D
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
•All geometric primitives are illuminatedAll geometric primitives are illuminated
![Page 50: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/50.jpg)
Lighting Simulation
Lighting parametersLighting parameters
• Light source emissionLight source emission
• Surface reflectanceSurface reflectance
• Atmospheric attenuationAtmospheric attenuation
• Camera responseCamera response
Lighting parametersLighting parameters
• Light source emissionLight source emission
• Surface reflectanceSurface reflectance
• Atmospheric attenuationAtmospheric attenuation
• Camera responseCamera responseN
N
Camera
Surface
LightSource
![Page 51: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/51.jpg)
Lighting Simulation
Direct illuminationDirect illumination
• Ray castingRay casting
• Polygon shadingPolygon shading
Global illuminationGlobal illumination
• Ray tracingRay tracing
• Monte Carlo methodsMonte Carlo methods
• Radiosity methodsRadiosity methods
Direct illuminationDirect illumination
• Ray castingRay casting
• Polygon shadingPolygon shading
Global illuminationGlobal illumination
• Ray tracingRay tracing
• Monte Carlo methodsMonte Carlo methods
• Radiosity methodsRadiosity methods
More on these methods later!More on these methods later!
NN
Camera
Surface
LightSource
N
![Page 52: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/52.jpg)
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• Scene vertices in 3-D “view” or “camera” coordinate systemScene vertices in 3-D “view” or “camera” coordinate system
The Rendering Pipeline: 3-D
![Page 53: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/53.jpg)
Rendering: Transformations
Viewing transformViewing transform
• Rotate & translate the world to lie directly in front of Rotate & translate the world to lie directly in front of the camerathe camera
– Typically place camera at originTypically place camera at origin
– Typically looking down -Z axisTypically looking down -Z axis
• World coordinatesWorld coordinates view coordinatesview coordinates
Viewing transformViewing transform
• Rotate & translate the world to lie directly in front of Rotate & translate the world to lie directly in front of the camerathe camera
– Typically place camera at originTypically place camera at origin
– Typically looking down -Z axisTypically looking down -Z axis
• World coordinatesWorld coordinates view coordinatesview coordinates
![Page 54: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/54.jpg)
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• Remove geometry that is out of viewRemove geometry that is out of view
The Rendering Pipeline: 3-D
![Page 55: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/55.jpg)
Assignment 2
Due two and a half weeks from todayDue two and a half weeks from today
• Project description available onlineProject description available online
• We’ll discuss details in class on MondayWe’ll discuss details in class on Monday
Due two and a half weeks from todayDue two and a half weeks from today
• Project description available onlineProject description available online
• We’ll discuss details in class on MondayWe’ll discuss details in class on Monday
![Page 56: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/56.jpg)
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
• 2-D screen coordinates of clipped vertices2-D screen coordinates of clipped vertices
The Rendering Pipeline: 3-D
![Page 57: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/57.jpg)
Rendering: Transformations
Projection transformProjection transform
• Apply perspective foreshorteningApply perspective foreshortening
– Distant = small: the Distant = small: the pinhole camerapinhole camera model model
• View coordinates View coordinates screen coordinates screen coordinates
Projection transformProjection transform
• Apply perspective foreshorteningApply perspective foreshortening
– Distant = small: the Distant = small: the pinhole camerapinhole camera model model
• View coordinates View coordinates screen coordinates screen coordinates
![Page 58: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/58.jpg)
Perspective CameraPerspective Camera
Orthographic CameraOrthographic Camera
Perspective CameraPerspective Camera
Orthographic CameraOrthographic Camera
Rendering: Transformations
![Page 59: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/59.jpg)
Rendering 3D Scenes
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
![Page 60: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/60.jpg)
Rasterize
Convert screen coordinates to pixel colorsConvert screen coordinates to pixel colorsConvert screen coordinates to pixel colorsConvert screen coordinates to pixel colors
![Page 61: Introduction to Computer Graphics CS 445 / 645 Lecture 6 Geometric primitives and the rendering pipepline Lecture 6 Geometric primitives and the rendering.](https://reader035.fdocuments.in/reader035/viewer/2022062221/56649e495503460f94b3c92f/html5/thumbnails/61.jpg)
Summary
Geometric primitivesGeometric primitives
• Points, vectorsPoints, vectors
Operators on these primitivesOperators on these primitives
• Dot product, cross product, normDot product, cross product, norm
The rendering pipelineThe rendering pipeline
• Move models, illuminate, move camera, clip, project to Move models, illuminate, move camera, clip, project to display, rasterizedisplay, rasterize
Geometric primitivesGeometric primitives
• Points, vectorsPoints, vectors
Operators on these primitivesOperators on these primitives
• Dot product, cross product, normDot product, cross product, norm
The rendering pipelineThe rendering pipeline
• Move models, illuminate, move camera, clip, project to Move models, illuminate, move camera, clip, project to display, rasterizedisplay, rasterize