bpc: art and computation – spring 2007 computer graphics – lighting and rendering erik brisson...

27
BPC: Art and Computation – Spring BPC: Art and Computation – Spring 2007 2007 Computer Graphics – Computer Graphics – Lighting and Rendering Lighting and Rendering Erik Brisson [email protected]

Post on 20-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007BPC: Art and Computation – Spring 2007

Computer Graphics – Lighting and Computer Graphics – Lighting and RenderingRendering

Erik Brisson

[email protected]

Page 2: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 2

GivenGiven P = (1.0, 2.0)P = (1.0, 2.0) T = (5.0, 1.0) T = (5.0, 1.0) Compute P’Compute P’ P’ = P + T = (1.0, 2.0) + (5.0, 1.0)P’ = P + T = (1.0, 2.0) + (5.0, 1.0) = (1.0+5.0, 2.0+1.0)= (1.0+5.0, 2.0+1.0) = (6.0, 3.0)= (6.0, 3.0)

Translation vectorTranslation vector

Page 3: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 3

Rotation by angle Rotation by angle

Define a rotation matrix Define a rotation matrix M = / cosM = / cos sin sin \ \ \ -sin\ -sin cos cos / /Then P’ = P Then P’ = P •• M MExample: Example: = 30 degrees. P = (3.5, 2.0) = 30 degrees. P = (3.5, 2.0)Then cosThen cos = 0.87 , sin = 0.87 , sin = 0.50 = 0.50P’ = (3.5, 2.0) P’ = (3.5, 2.0) •• / 0.87 0.50 \ / 0.87 0.50 \ \ -0.50 0.87 /\ -0.50 0.87 / = (3.5*0.87+2.0*-0.50, 3.5*0.50+2.0*0.87)= (3.5*0.87+2.0*-0.50, 3.5*0.50+2.0*0.87) = (2.05, 3.49)= (2.05, 3.49)

Page 4: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 4

Scaling by Sx, SyScaling by Sx, Sy

Define a scaling matrix Define a scaling matrix M = / Sx 0 \M = / Sx 0 \ \ 0 Sy /\ 0 Sy /Then P’ = P Then P’ = P •• M MExample: Sx = 0.5, Sy = 2.0Example: Sx = 0.5, Sy = 2.0P’ = (2.0, 2.0) P’ = (2.0, 2.0) •• / 0.5 0.0 \ / 0.5 0.0 \ \ 0.0 2.0 /\ 0.0 2.0 / = (2.0*0.5+2.0*0.0, 2.0*0.0+2.0*2.0)= (2.0*0.5+2.0*0.0, 2.0*0.0+2.0*2.0) = (1.0, 4.0)= (1.0, 4.0)

Page 5: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 5

P’ = P + TP’ = P + TT = P’ – PT = P’ – PExample, T = P’ – P = (6.0, 3.0) – (1.0, 2.0)Example, T = P’ – P = (6.0, 3.0) – (1.0, 2.0) = (5.0, 1.0) = (5.0, 1.0)

Vector as difference of pointsVector as difference of points

Page 6: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 6

Back to lightingBack to lighting

V_eye = P_eye - PV_light = P_light - P

V_eye = (4, 1, 10) - (5, 2, 3) = (-1, -1, 7)V_light = (3, 7, 2) – (5, 2, 3) = (-2, 5, -1)

Page 7: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 7

Unit shading vectorsUnit shading vectors

n = surface normal vectoru_light = unit vector to light pointu_eye = unit vector to view point

Page 8: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 8

Ray castingRay casting

Page 9: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 9

Ray cast, with lightRay cast, with light

Page 10: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 10

Ray tracingRay tracing

Page 11: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 11

Scan-conversion ideaScan-conversion idea

Page 12: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 12

Scan-conversion of polygonScan-conversion of polygon

Page 13: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 13

Shading at vertices, interpolationShading at vertices, interpolation

Page 14: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 14

Flat shading vs Gouraud shadingFlat shading vs Gouraud shading

Page 15: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 15

ShadingShadingambient

diffuse

specular

Page 16: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 16

ObscurationObscuration

Some objects block othersSort back-to-frontZ-buffer algorithm

Page 17: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 17

C.G. concept - texture mapC.G. concept - texture map

Page 18: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 18

C.G. example - texture mapC.G. example - texture map

Page 19: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 19

Texture map fullTexture map full

++

Page 20: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 20

The quest for photorealismThe quest for photorealism

Page 21: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 21

Alternative rendering techniquesAlternative rendering techniques

Page 22: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 22

Alternative rendering techniquesAlternative rendering techniques

Page 23: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 23

3D object photography3D object photography

http://www.royalalbertamuseum.ca/vexhibit/virtcoll/index.asp

Page 24: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 24

Panoramic photographyPanoramic photography

Page 25: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 25

Other techniquesOther techniques

Page 26: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 26

Other techniques, laser scanningOther techniques, laser scanning

Page 27: BPC: Art and Computation – Spring 2007 Computer Graphics – Lighting and Rendering Erik Brisson ebrisson@bu.edu

BPC: Art and Computation – Spring 2007 27

Now we can model, transform, Now we can model, transform, illuminate, and render doughnutsilluminate, and render doughnuts