Presentation is loading. Please wait.

Presentation is loading. Please wait.

Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003.

Similar presentations


Presentation on theme: "Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003."— Presentation transcript:

1 Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003

2 Geometry vs. Detail There is a practical limit to how much detail we can show with geometry. For example, imagine trying to create the appearance of a brick wall through geometry. Construct brick and cement rectangles. Color them dark red and light gray. Would they look realistic?

3 Textures A much more efficient method is to Photograph an actual brick wall. Create a single large polygon. Paste the photograph onto the polygon. Not only is this more efficient, but the results are superior. These pictures are called textures, since they give “texture” to a surface.

4 Textures A texture may be created externally as a bitmap file (.bmp). It consists of a rectangular array of RGB triples (integers from 0 to 255). Each RGB triple is called a texel.

5 Examples WoodGrain.bmp. Bricks.bmp. TextureDemo.cppTextureDemo.cpp. RgbImage.cppRgbImage.cpp.

6 Textures It is also possible to create textures internally as arrays of RGB triples. This is especially convenient when the picture is geometrically simple. The object would be a 3-dimensional array image[i][j][k]. i = row number. j = column number. k = color (0 = red, 1 = green, 2 = blue).

7 Textures It is possible to have 1-dimensional, 2- dimensional, and 3-dimensional textures, although we will work only with 2-dimensional textures. A texture has its own (s, t) coordinate system. s is the horizontal coordinate, 0  s  1. t is the vertical coordinate, 0  t  1.

8 Texture Parameters Each texel has (r, s) coordinates. 0 1 0 1 s t (.5,.5) (.75,.25)

9 Textures To paste a texture onto a polygon, we assign to each vertex of the polygon a pair of (s, t) coordinates. That is, we map a portion of the texture to the polygon. Interpolation is used to assign a texel to each pixel throughout the interior of the polygon.

10 Mapping Textures to Faces When a polygon is drawn, each vertex has a point in the texture mapped to it.

11 Nate Robin’s Texture Tutorial Tutors


Download ppt "Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003."

Similar presentations


Ads by Google