5
©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

Embed Size (px)

Citation preview

Page 1: ©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges(modified by Amos Johnson)

1

Shading Models

Page 2: ©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges(modified by Amos Johnson)

2

Flat ShadingEvery pixel interior to the polygon is assigned the same

intensity. The normal at a point on the polygon is the normal of the plane determined by the polygon. (Use cross product of edge vectors to compute normal.)

•Fast and simple, uses standard polygon fill provided by most frame buffers

•Shading of a polygon independent of shade of adjacent polygons

•Gives object a faceted appearance

Page 3: ©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges(modified by Amos Johnson)

3

Gouraud Shading1. Approximate the normal to the

surface at a vertex by averaging all normals of abutting polygons.

2. Calculate the intensity at each vertex using illumination equations.

N

N

NN

N

1

2

34avg

3. Use linear interpolation along a polygon edge to compute the intensity at each edge pixel.

4. Use linear interpolation along a scan line to compute the intensity at each interior pixel of a polygon.

D1 D2

D3D4

a

b

A

DA = (bD1 + aD4)/(a+b)

Page 4: ©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges(modified by Amos Johnson)

4

Phong Shading

1. Approximate the normal to the surface at a vertex by averaging all normals of abutting polygons.

2. Interpolate normals along the edge between two vertex points.

Page 5: ©Larry F. Hodges (modified by Amos Johnson) 1 Shading Models

©Larry F. Hodges(modified by Amos Johnson)

5

Pros and Cons• Flat Shading

– Pro: Simple and fast

– Con: Flat appears and polygon sections looks discontinuous.

• Gourand Shading– Pro: Polygon section looks continuous.

– Con: May miss specular reflections.

• Phong Shanding– Pro: Keeps specular reflections

– Con: High complexity because illumination is compute at every pixel.