Lighting and Shading - University of Calgary in...

12
1 Lighting and Shading Adding colour • Combine Shading - recap r v r K L n l K L K I sr dr dr ar ar r a ) ( ) ( = r L b v r K L n l K L K I sb db db ab ab b a ) ( ) ( = g v r K L n l K L K I sg dg dg ag ag g a ) ( ) ( = g I g L b I b L 1 L b g r I I I r I

Transcript of Lighting and Shading - University of Calgary in...

Page 1: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

1

Lighting and Shading

• Adding colour

• Combine

Shading - recap

rvrKLnlKLKI srdrdrararrα)()( ⋅+⋅+=

rL

bvrKLnlKLKI sbdbdbababbα)()( ⋅+⋅+=

gvrKLnlKLKI sgdgdgagaggα)()( ⋅+⋅+=

gIgL

bIbL

1L

bgr III ++

rI

Page 2: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

2

• Adding colour

• Combine

Shading - recap

rvrKLnlKLKI srdrdrararrα)()( ⋅+⋅+=

rL

bvrKLnlKLKI sbdbdbababbα)()( ⋅+⋅+=

gvrKLnlKLKI sgdgdgagaggα)()( ⋅+⋅+=

gIgL

bIbL

1L

bgr III ++

rI

Gouraud Shading (intensity interpolation)

Page 3: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

3

Phong Shading (normal vector interpolation)

• Normal vector interpolation along each edge and each scan line

Shading comparisonsFlat• single colour to each

polygon

• fast • facetted look

Phong• vector normal

interpolation• more accurate• more realistic highlights• much less Mach banding

• much more computation

Gouraud• intensity interpolation• smoother effect

• some mach banding• specular highlights

handled poorly• more computation

Page 4: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

4

Human Perception and Light

• Difference Signaling• Contrast vs. value information• Light value information vs. object information.

• cell has normal rate• light in centre excites • light in surrounds inhibits

• Colour and Lightness Constancy

Consequences

• Hermann Grid Illusion

Page 5: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

5

Consequences• Scintillating Grid

Consequences• Simultaneous Brightness Contrast

Page 6: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

6

Consequences• Grating Induction Effect

Consequences• Mach Banding

Page 7: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

7

Consequences• Chevreul Illusion

Consequences• Crispening

Page 8: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

8

Consequences• Craik-Cornsweet Effect

Consequences• Craik-Cornsweet Effect

Page 9: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

9

Seurat: The Bathers• Craik-Cornsweet Effect

Shading Comparisons

Page 10: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

10

Page 11: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

11

More on Phong shading

Problems with interpolation methods• Expensive: since illumination calculation is repeated for

every pixel. Also calculating and normalising new normal. (Schlick equation and table look up methods).

• Silhouette edge: Attempts have been made to modify normals to match a curve fitted to the edge. (see Van Overveld and Wyvill)

• Perspective distortion: Intensity interpolation is performed in screen space. The z has undergone a non-linear transformation.

Page 12: Lighting and Shading - University of Calgary in Albertapages.cpsc.ucalgary.ca/~sheelagh/courses/453/shading-3.pdf · 2003-12-06 · Lighting and Shading • Adding colour • Combine

12

Problems with interpolation methods• Orientation Dependence: The results of an interpolation model are

not independent of the projected polygons orientation. Results may differ when the polygon is rotated affecting animations.

• Problems at Shared Vertices: This problem is analagous to the cracks problem in subdivided meshes. The undivided edge is interpolated differently to the two divided edges.

• Unrepresentative Vertex Normals: Pathalogical cases where interpolated normals give poor results. Examples are staircase example and mobius strip.