mit eecs 6.837, durand and teller 1 the rendering pipeline local illumination models mit eecs 6.837...

25
MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

Upload: melissa-melinda-nichols

Post on 02-Jan-2016

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 1

The Rendering PipelineLocal Illumination Models

MIT EECS 6.837

Lecture 4, September 17th 2002

Page 2: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 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.)

Page 3: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 4: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 5: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 6: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 6

Rendering abstraction I

Input OutputRendering Pipeline

?

Page 7: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 7

Rendering inputs

• Scene description• Lighting description & lighting model• Synthetic camera parameters• Raster viewport parameters

Page 8: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 8

Scene description

• Object geometry, placement, material properties

Page 9: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 9

Lighting description & model

• Light source locations and characteristics

Page 10: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 10

Synthetic camera parameters

• Synthetic camera parameters– Eye position and view frustum

Page 11: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 12: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 13: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 13

Rendering abstraction I

Input OutputRendering Pipeline

Scene descriptionLighting descriptionSynthetic camera

parametersRaster viewport

parameters

Page 14: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 14

Rendering Pipeline (Abstracted)

Page 15: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 15

Lighting

Page 16: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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?

Page 17: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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)!

Page 18: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 19: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 20: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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?

Page 21: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 22: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

MIT EECS 6.837, Durand and Teller 22

Faceted and smooth shading

Page 23: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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,…

Page 24: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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

Page 25: MIT EECS 6.837, Durand and Teller 1 The Rendering Pipeline Local Illumination Models MIT EECS 6.837 Lecture 4, September 17 th 2002

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