smooth shading gouraud phong

12
CSE 681 Smooth Shading Gouraud Phong

Upload: morey

Post on 05-Jan-2016

28 views

Category:

Documents


0 download

DESCRIPTION

Smooth Shading Gouraud Phong. Interpolate value(s) for point in face from values at vertices. http://www.blancmange.info/notes/maths/vectors/primitives/. For each vertex, v Nv = For each face of vertex Compute face normal Nv += face normal Normalize Nv. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Smooth Shading Gouraud Phong

CSE 681

Smooth ShadingGouraudPhong

Page 2: Smooth Shading Gouraud Phong

CSE 681

Interpolate value(s) for point in face from values at vertices

http://www.blancmange.info/notes/maths/vectors/primitives/

Page 3: Smooth Shading Gouraud Phong

CSE 681

Compute normals at vertices

For each vertex, v Nv = <0,0,0> For each face of vertex Compute face normal Nv += face normal Normalize Nv

For each vertex, v Nv = <0,0,0>For each face Compute face normal For each vertex of face Nv += face normalFor each vertex, v Normalize Nv

Page 4: Smooth Shading Gouraud Phong

CSE 681

Interpolate value(s) for point in face from values at vertices

Gouraud smooth shading:1. Compute normals at vertices2. Compute color at vertices3. Interpolate interior color

Page 5: Smooth Shading Gouraud Phong

CSE 681

Mach Band Effect

Smoothly shaded objects

Colors are continuous, but not derivatives

Eye picks up on this and accentuates discontinuity

Page 6: Smooth Shading Gouraud Phong

CSE 681

Interpolate value(s) for point in face from values at vertices

Phong smooth shading:1. Compute normals at vertices2. Interpolate interior normal3. Compute color at point

Page 7: Smooth Shading Gouraud Phong

CSE 681

Interpolate value(s) for point in face from values at vertices

Page 8: Smooth Shading Gouraud Phong

CSE 681

Interpolate value(s) scanline algorithms

Interpolate down edges, across scanline

Page 9: Smooth Shading Gouraud Phong

CSE 681

Point sample Quadrilateralinverse binlinear map then use u,v

values to interpolate

)()(

)(

)()()11(

))1(())1)((1(

)1(

)1(

)1(

001000100111

00000100

0000100001001001

11011000

10

11011

10000

PPPPPPv

PPPvPPu

PPPuPPvPPPPvuP

uPPuvuPPuvP

vPPvP

uPPuP

uPPuP

uv

uv

uv

uuuv

u

u

Page 10: Smooth Shading Gouraud Phong

CSE 681

Point sample Triangle compute barycentric coordinates

then use to interpolate

ab

c Pa

Pb

Pc

P

P=aPa+bPb+cPc

Normalized so that a+b+c=1

Page 11: Smooth Shading Gouraud Phong

CSE 681

Area of a triangle - using vector algebra

Pa

Pb

Pc

h

Area = (1/2)h|Vab|

h = |Vbc |sin()

|Vab x Vbc| = |Vab | |Vbc|sin()

Area = (1/2) |Vab x Vbc|

Area = (1/2) |Vab| |Vbc |sin()

Page 12: Smooth Shading Gouraud Phong

CSE 681

Examples of smooth shading

See links off of course web site