Beruflich Dokumente
Kultur Dokumente
Reading
Chapter 5.5 - Angel Chapter 16 - Foley, van Dam, et al
Machiraju/Zhang/Mller
Shading
Illumination Model: determine the color of a surface (data) point by simulating some light attributes. Local IM: deals only with isolated surface (data) point and direct light sources. Global IM: takes into account the relationships between all surfaces (points) in the environment. Shading Model: applies the illumination models at a set of points and colors the whole scene.
Machiraju/Zhang/Mller 3
Shading of surfaces
We can shade a point on a surface using a local IM How about surfaces?
Flat (planar) polygons are computationally attractive
Normals, intersections, visibility, projections, etc., are all easy to compute hardware acceleration available
Curved surfaces are often tessellated into many small at polygons in graphics polygonal Machiraju/Zhang/Mller meshes
Polygonal meshes
Composed of a set of polygons (often quadrilaterals or triangles) pasted along their edges The dominant surface model for 3D shapes (esp. free-form shapes), e.g., in games Well, now there are points
Machiraju/Zhang/Mller
Shading of at polygons
Flat (constant, faceted) shading
compute illumination once per polygon and apply it to whole polygon: glShadeModel(GL_FLAT)
Interpolated/smooth/Gouraud shading
compute illumination at borders (e.g. vertices) and interpolate: glShadeModel(GL_SMOOTH)
Flat shading
A single color across the polygon efcient Intensity discontinuity across edges N1 Flat shading would be correct if
Light source is at innity, i.e., light vector l is constant, so nl is constant across polygon, and viewer is at innity, so rv is constant across polygon, and polygons represent actual surface, not an approximation N2
Also, if there are a very large number of very small polygons, the faceting effects is less obvious Machiraju/Zhang/Mller spatial integration of our eyes
Results of at shading
Machiraju/Zhang/Mller
Mach Banding
Creates discontinuities in colour
easily visible hence we can see the distinct surface patches easily
Machbands!
caused by lateral inhibition of the receptors in the eye
Machiraju/Zhang/Mller
Machiraju/Zhang/Mller
10
Gouraud shading
This shading model is interpolative:
Given colors of the polygon vertices, interior points are colored through bilinear interpolation
11
Color interpolation
Interpolate colors along edges and scanlines Can be done incrementally, i.e., via scanlines
Machiraju/Zhang/Mller
12
Machiraju/Zhang/Mller
13
Phong shading
Gouraud shading does not properly handle specular highlights because of color interpolation
Machiraju/Zhang/Mller
15
Machiraju/Zhang/Mller
16
Solution: triangulate
Machiraju/Zhang/Mller
17
Machiraju/Zhang/Mller
18