Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Meshes

Similar presentations


Presentation on theme: "Introduction to Meshes"— Presentation transcript:

1 Introduction to Meshes
Lecture 21 Wed, Oct 26, 2005

2 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.

3 Solid Model

4 Wireframe Model

5 Solid Model (69451 faces)

6 Wireframe Model

7 Close-up of Wireframe Model

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

9 Shading Models In flat shading, the entire polygon is given the shade of a single vertex. In smooth shading, the colors of the vertices are interpolated across the polygon. Use the OpenGL function glShadeModel() with one parameter. GL_FLAT GL_SMOOTH

10 One Normal, Uniform Shading

11 Distinct Normals, Varying Shading

12 Shading, Lighting, and Textures of Faces
In the absence of lighting and textures, the shade of each vertex is determined by glColor(). If lighting is enabled, the shade of each vertex is computed from the lighting effects. If textures are used, the shade of each vertex is determined by the texels or a combination of texels, lighting, and color.

13 Shading, Lighting, and Textures of Faces
In all three cases, once the shade of the vertices is determined, then those shades are interpolated across the pixels, shading all the pixels in the polygon’s interior.

14 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 P, Q, and R of the triangle, where a + b + c = 1. These are the barycentric coordinates.

15 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.

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

17 Shading a Triangle What is the color of the outlined pixel?
R(4, 8), color = (1, 0, 0) Q(12, 0) color = (0, 1, 1) P(0, 0) color = (1, 1, 0)

18 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,

19 Shading a Triangle The solution is
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).

20 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) color = (7/8, 5/8, 1/8)

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

22 Method of Interpolation
An alternate way to calculate the color of a point C is to use interpolation. Interpolate along the edges PR and QR to find the colors of the endpoints of the horizontal row containing C. Interpolate across the row between the endpoints. This method requires 3 interpolations.

23 Method of Interpolation
Consider again the triangle and the pixel at (3, 3). R(4, 8), color = (1, 0, 0) Q(12, 0) color = (0, 1, 1) P(0, 0) color = (1, 1, 0)

24 Method of Interpolation
Interpolate for the endpoints A and B of row 3. R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1) B = (5/8)Q + (3/8)R A = (5/8)P + (3/8)R

25 Method of Interpolation
Compute the colors of the horizontal endpoints. R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1) A = (5/8)P + (3/8)R B = (5/8)Q + (3/8)R color = (1, 5/8, 0) color = (3/8, 5/8, 5/8)

26 Method of Interpolation
Interpolate for the point C. R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1) A = (5/8)P + (3/8)R B = (5/8)Q + (3/8)R color = (1, 5/8, 0) color = (3/8, 5/8, 5/8) C = (6/7.5)A + (1.5/7.5)B

27 Method of Interpolation
Compute the color of C. R(4, 8), color = (1, 0, 0) P(0, 0) color = (1, 1, 0) Q(12, 0) color = (0, 1, 1) A = (5/8)P + (3/8)R B = (5/8)Q + (3/8)R color = (1, 5/8, 0) color = (3/8, 5/8, 5/8) C = (6/7.5)A + (1.5/7.5)B color = (7/8, 5/8, 1/8)


Download ppt "Introduction to Meshes"

Similar presentations


Ads by Google