introduction to computer graphics cs 445 / 645 lecture 6 geometric primitives and the rendering...
TRANSCRIPT
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)
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
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
3D Rendering Example
What issues must be addressed by a 3D rendering system?
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
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?
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.
3D Point
Specifies a locationSpecifies a locationSpecifies a locationSpecifies a location
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)
3D Vector
Specifies a direction and a magnitudeSpecifies a direction and a magnitudeSpecifies a direction and a magnitudeSpecifies a direction and a magnitude
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)
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
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
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
Coordinate Systems
lGrasp z-axis with handlThumb points in direction of z-axis lRoll fingers from positive x-axis towards positive y-axis
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
3D Line Segment
Linear path between two pointsLinear path between two pointsLinear path between two pointsLinear path between two points
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
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
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
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)
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
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
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
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(
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
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
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
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
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
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
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
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
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
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
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
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
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
Rendering 3D Scenes
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
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)
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?
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
Moving the camera
View Frustum
Right
BackTowards
Up
The Rendering Pipeline
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
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)
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
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
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
The Rendering Pipeline: 3-D
ModelingTransforms
Scene graphObject geometry
LightingCalculations
ViewingTransform
Clipping
ProjectionTransform
Result:Result:
•All geometric primitives are illuminatedAll geometric primitives are illuminated
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
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
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
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
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
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
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
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
Perspective CameraPerspective Camera
Orthographic CameraOrthographic Camera
Perspective CameraPerspective Camera
Orthographic CameraOrthographic Camera
Rendering: Transformations
Rendering 3D Scenes
Transform
Illuminate
Transform
Clip
Project
Rasterize
Model & CameraModel & CameraParametersParameters Rendering PipelineRendering Pipeline FramebufferFramebuffer DisplayDisplay
Rasterize
Convert screen coordinates to pixel colorsConvert screen coordinates to pixel colorsConvert screen coordinates to pixel colorsConvert screen coordinates to pixel colors
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