mit eecs 6.837, durand and teller 1 the rendering pipeline local illumination models mit eecs 6.837...
TRANSCRIPT
MIT EECS 6.837, Durand and Teller 1
The Rendering PipelineLocal Illumination Models
MIT EECS 6.837
Lecture 4, September 17th 2002
MIT EECS 6.837, Durand and Teller 2
Administrative Notes
ROOM CHANGE:
Starting this Thursday Sept. 19th,6.837 will meet in room 2-190
(We will post signage to remind you.)
MIT EECS 6.837, Durand and Teller 3
Administrative Notes • Assignment 1: Due this Friday (9/20) at 5pm
– Questions about the assignment?– Use turnin as directed on course page
• Final projects will be due December 4th – Presentations scheduled for December 4th –10th
• Staff Office Hours– Durand: R 4-5 in 4-035 cluster; R 5-6 in NE43-254 – Teller: W 3-4 in NE43-252; R 4-5 in 4-035 cluster– Ngan: R 2-6pm (location TBD)– Yu: TBD
MIT EECS 6.837, Durand and Teller 4
Inventor Resources for Assignment 1• Example Files & Documentation
– Athena IRIX: /usr/share/data/models/– Athena Linux: /mit/inventor/distrib/share/data/models– athena% man SoCube, man SoTranslation, etc.
(must have /usr/share/catman or /mit/inventor/man in $MANPATH)
• On reserve at LCS reading room:– Open Inventor C++ Reference Manual (The “green
book”)– Inventor Mentor (The “orange book”)
• On Web: – Various helpful links from course page– Many illustrative Inventor files exist on-line
MIT EECS 6.837, Durand and Teller 5
Lecture Plan
• Last week:– Object-space to world-space transformations– Object modeling using Inventor language, tools
• Today:– Overview of classical “rendering pipeline”– Local illumination models (simplified)
• Thursday:– Eye-space & perspective transformations– Segment (2D) and polygon (frustum) clipping
MIT EECS 6.837, Durand and Teller 6
Rendering abstraction I
Input OutputRendering Pipeline
?
MIT EECS 6.837, Durand and Teller 7
Rendering inputs
• Scene description• Lighting description & lighting model• Synthetic camera parameters• Raster viewport parameters
MIT EECS 6.837, Durand and Teller 8
Scene description
• Object geometry, placement, material properties
MIT EECS 6.837, Durand and Teller 9
Lighting description & model
• Light source locations and characteristics
MIT EECS 6.837, Durand and Teller 10
Synthetic camera parameters
• Synthetic camera parameters– Eye position and view frustum
MIT EECS 6.837, Durand and Teller 11
Raster viewport parameters
• Resolution (width x height) of pixel grid
onto which image plane is to be mapped
MIT EECS 6.837, Durand and Teller 12
Rendering output
• Framebuffer assignment– Per-pixel intensity values suitable for
display• For example, an RGB value for each
framebuffer pixel
– Optionally, a depth (or z-value) at each pixel
MIT EECS 6.837, Durand and Teller 13
Rendering abstraction I
Input OutputRendering Pipeline
Scene descriptionLighting descriptionSynthetic camera
parametersRaster viewport
parameters
MIT EECS 6.837, Durand and Teller 14
Rendering Pipeline (Abstracted)
MIT EECS 6.837, Durand and Teller 15
Lighting
MIT EECS 6.837, Durand and Teller 16
Transforming normal vectors
• Suppose M takes object to world coordinates: p’ = M p
• How are normal vectors transformed? n’ = ?
M?
MIT EECS 6.837, Durand and Teller 17
Transforming normal vectors
• First attempt: just use transform M (e.g., shear):
1000
000
000
00
1
'
'
'
z
y
x
z
y
x
1
11
1
1
Normals (0,1) and (1,0)transform to (1,1) and (1,0)!
MIT EECS 6.837, Durand and Teller 18
Transforming normal vectors• We know that for p on H, n normal to H
nT p = 0• And for any non-singular transform M that
nT (M-1 M) p = 0• Which can be rewritten as
( nT M-1 ) ( M p ) = 0• Thus the transpose of the transformed normal
is ( nT M-1 )
• And the transformed normal itself is the transpose ( nT M-1 )T = M-T n
MIT EECS 6.837, Durand and Teller 19
Transforming normal vectors
• Thus under action of M, points transform as p’ = M p
• And normal vectors transform as n’ = M-T n
M p’ = M p
n’ = M-T n
MIT EECS 6.837, Durand and Teller 20
Correct transformation• Using same shear transform M as before:
000
000
000
00
1
-11
1
1
000
000
00-1
00
1
01
1
1M-1 M-T
Normals (0,1) and (1,0)transform to (0,1) and (1,-
1)
… are we done?
MIT EECS 6.837, Durand and Teller 21
Lighting: Putting it all together
• Issue scene geometry to graphics pipeline,transforming geometry, normals correctly
• Apply lighting equation at polygon verticesby evaluating Phong illumination model there
• Interpolate vertex colors across polygoninteriors to produce color at each pixel
MIT EECS 6.837, Durand and Teller 22
Faceted and smooth shading
MIT EECS 6.837, Durand and Teller 23
Faceted and smooth shading• Per-face normals:
# .../ivexamples/facetedpear.ivCoordinate3 { ... }NormalBinding { value PER_FACE }IndexedFaceSet { coordIndex [ 0, 1, 2, -1,…
• Per-vertex normals# .../ivexamples/smoothpear.ivCoordinate3 { ... } # x y z per vertexNormal { ... } # dx dy dz per vertexNormalBinding { value PER_VERTEX }IndexedFaceSet { coordIndex [ 0, 1, 2, -1,…
MIT EECS 6.837, Durand and Teller 24
When to Apply Lighting Equation?• Apply in object space
– Adv: easy to compute normals– Disadv: Must transform lights to object
space
• So: apply in world coordinates– Adv: lights usually specified in world space
• This is most common practice, but:– 1) What if some vertices lie outside
frustum?– 2) Must transform normals to world space
MIT EECS 6.837, Durand and Teller 25
Next time, we’ll:
• Continue our trip down the graphics pipeline
• Study further relevant transformations• See efficient segment and polygon
clipping