Introduction to Meshes Lecture 22 Mon, Oct 20, 2003
Chapter 6 Modeling Shapes with Polygonal Meshes
Introduction to Solid Modeling with Polygonal Meshes In computer graphics, we do not draw surfaces that are truly curved. Instead, each surface consists of many small polygons connected in a mesh. This is also called a wireframe. If we fill the polygons in the mesh, then the surface looks solid.
Solid Model
Wireframe Model
Solid Model (69451 faces)
Wireframe Model
Close-up of Wireframe Model
Polygonal Faces The simplest of all polygonal faces is the triangle. Triangles have two major advantages. All triangles are planar. All triangles are convex.
One Normal for the Face The normal may be calculated from the vertices. n = (Q – P) (R – P). P R Q n
One Normal for each Vertex The normal at each vertex may be perpendicular to the face. n 1 = n 2 = n 3. n1n1 n3n3 n2n2
One Normal for each Vertex The normal at each vertex may point in a unique direction. n 1 n 2 n 3. n1n1 n3n3 n2n2
Lighting and Normals When using a lighting model, the brightness and color of the surface are determined, in part, by the normals. If there is one normal, the surface is of uniform brightness. This is called flat shading.
Lighting and Normals If each vertex has a distinct normal, then the brightness may vary over the surface. This is called smooth shading.
One Normal, Uniform Shading
Distinct Normals, Varying Shading
Shading a Triangle We will study lighting models later. Lighting models determine how to color, or shade, a vertex. For now, we will assume that each vertex has been assigned a shade. Note: “shading” has nothing to do with shadows. It refers to the shade of color.
Shading a Triangle Each point in the interior and on the boundary of a triangle can be expressed as a linear combination aP + bQ + cR of the three vertices of the triangle, where a + b + c = 1. These are the barycentric coordinates.
Shading a Triangle The coefficients a, b, c are used to determine the color of the point in the triangle. The color of the point is the same linear combination of the colors of the vertices. This is done for each pixel that is part of the triangle.
Consider this triangle. Shading a Triangle R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1)
Shading a Triangle What is the color of the outlined pixel? R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1)
Shading a Triangle The coordinates are (3, 3). Solve the system a(0, 0) + b(12,0) + c(4, 8) = (3, 3), a + b + c = 1. The equations are 12b + 4c = 3, 8c = 3, a + b + c = 1.
Shading a Triangle The solution is a = 1/2. b = 1/8. c = 3/8. Therefore, the color of the pixel is (1/2)(1, 1, 0) + (1/8)(0, 1, 1) + (3/8)(1, 0, 0) = (7/8, 5/8, 1/8).
Shading a Triangle R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1) color = (7/8, 5/8, 1/8)
Shading a Triangle The entire triangle R(4, 8) P(0, 0) Q(12, 0)