smooth shading gouraud phong
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 PresentationTRANSCRIPT
CSE 681
Smooth ShadingGouraudPhong
CSE 681
Interpolate value(s) for point in face from values at vertices
http://www.blancmange.info/notes/maths/vectors/primitives/
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
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
CSE 681
Mach Band Effect
Smoothly shaded objects
Colors are continuous, but not derivatives
Eye picks up on this and accentuates discontinuity
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
CSE 681
Interpolate value(s) for point in face from values at vertices
CSE 681
Interpolate value(s) scanline algorithms
Interpolate down edges, across scanline
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
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
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()
CSE 681
Examples of smooth shading
See links off of course web site