Introduction to Meshes Lecture 22 Mon Oct 20

  • Slides: 25
Download presentation
Introduction to Meshes Lecture 22 Mon, Oct 20, 2003

Introduction to Meshes Lecture 22 Mon, Oct 20, 2003

Chapter 6 Modeling Shapes with Polygonal Meshes

Chapter 6 Modeling Shapes with Polygonal Meshes

Introduction to Solid Modeling with Polygonal Meshes In computer graphics, we do not draw

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

Solid Model

Wireframe Model

Wireframe Model

Solid Model (69451 faces)

Solid Model (69451 faces)

Wireframe Model

Wireframe Model

Close-up of Wireframe Model

Close-up of Wireframe Model

Polygonal Faces The simplest of all polygonal faces is the triangle. Triangles have two

Polygonal Faces The simplest of all polygonal faces is the triangle. Triangles have two major advantages. n n All triangles are planar. All triangles are convex.

One Normal for the Face The normal may be calculated from the vertices. n

One Normal for the Face The normal may be calculated from the vertices. n = (Q – P) (R – P). R n P Q

One Normal for each Vertex The normal at each vertex may be perpendicular to

One Normal for each Vertex The normal at each vertex may be perpendicular to the face. n 1 = n 2 = n 3. n 1 n 2 n 3

One Normal for each Vertex The normal at each vertex may point in a

One Normal for each Vertex The normal at each vertex may point in a unique direction. n 1 n 2 n 3. n 2 n 1 n 3

Lighting and Normals When using a lighting model, the brightness and color of the

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

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

One Normal, Uniform Shading

Distinct Normals, Varying Shading

Distinct Normals, Varying Shading

Shading a Triangle We will study lighting models later. Lighting models determine how to

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

Shading a Triangle Each point in the interior and on the boundary of a triangle can be expressed as a linear combination a. P + b. Q + c. R 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

Shading a Triangle The coefficients a, b, c are used to determine the color of the point in the triangle. n 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.

Shading a Triangle Consider this triangle. R(4, 8), color = (1, 0, 0) P(0,

Shading a Triangle Consider this 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

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) +

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 12 b + 4 c = 3, 8 c = 3, a + b + c = 1.

Shading a Triangle The solution is n n n a = 1/2. b =

Shading a Triangle The solution is n n n 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) color = (7/8, 5/8,

Shading a Triangle R(4, 8), color = (1, 0, 0) color = (7/8, 5/8, 1/8) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1)

Shading a Triangle The entire triangle R(4, 8) P(0, 0) Q(12, 0)

Shading a Triangle The entire triangle R(4, 8) P(0, 0) Q(12, 0)