View
218
Download
0
Embed Size (px)
Citation preview
BPC: Art and Computation – Spring 2007BPC: Art and Computation – Spring 2007
Computer Graphics – Lighting and Computer Graphics – Lighting and RenderingRendering
Erik Brisson
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
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)
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)
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
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)
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
BPC: Art and Computation – Spring 2007 8
Ray castingRay casting
BPC: Art and Computation – Spring 2007 9
Ray cast, with lightRay cast, with light
BPC: Art and Computation – Spring 2007 10
Ray tracingRay tracing
BPC: Art and Computation – Spring 2007 11
Scan-conversion ideaScan-conversion idea
BPC: Art and Computation – Spring 2007 12
Scan-conversion of polygonScan-conversion of polygon
BPC: Art and Computation – Spring 2007 13
Shading at vertices, interpolationShading at vertices, interpolation
BPC: Art and Computation – Spring 2007 14
Flat shading vs Gouraud shadingFlat shading vs Gouraud shading
BPC: Art and Computation – Spring 2007 15
ShadingShadingambient
diffuse
specular
BPC: Art and Computation – Spring 2007 16
ObscurationObscuration
Some objects block othersSort back-to-frontZ-buffer algorithm
BPC: Art and Computation – Spring 2007 17
C.G. concept - texture mapC.G. concept - texture map
BPC: Art and Computation – Spring 2007 18
C.G. example - texture mapC.G. example - texture map
BPC: Art and Computation – Spring 2007 19
Texture map fullTexture map full
++
BPC: Art and Computation – Spring 2007 20
The quest for photorealismThe quest for photorealism
BPC: Art and Computation – Spring 2007 21
Alternative rendering techniquesAlternative rendering techniques
BPC: Art and Computation – Spring 2007 22
Alternative rendering techniquesAlternative rendering techniques
BPC: Art and Computation – Spring 2007 23
3D object photography3D object photography
http://www.royalalbertamuseum.ca/vexhibit/virtcoll/index.asp
BPC: Art and Computation – Spring 2007 24
Panoramic photographyPanoramic photography
BPC: Art and Computation – Spring 2007 25
Other techniquesOther techniques
BPC: Art and Computation – Spring 2007 26
Other techniques, laser scanningOther techniques, laser scanning
BPC: Art and Computation – Spring 2007 27
Now we can model, transform, Now we can model, transform, illuminate, and render doughnutsilluminate, and render doughnuts