Texture Mapping Example
So far we have just used a simple colored material for our mesh.
Texture mapping example. A brief introduction to texture mapping. Think of a texture as a piece of paper with a nice brick image for example on it neatly folded over your 3d house so it looks like your house has a stone exterior. Texture mapping is the electronic equivalent of applying wallpaper paint or veneer to a real object. In opengl textures can be used for many things but most commonly it s mapping an image to a polygon for example a triangle.
A simple example would be applying a brick image onto a square which makes the square look like an original wall. If we want to create something more realistic we ll have to start using a technique called texture mapping. For a two dimensional texture map for example the texture coordinates range from 0 0 to 1 0 in both directions but the coordinates of the items being textured can be anything. The following diagram represents the idea of texture mapping.
For the brick wall example if the wall is square and meant to represent one copy of the texture the code would probably assign texture coordinates 0 0 1 0. We assign a texture coordinate to each vertex of a polygon and it will be then. Texture mapping is a graphic design process in which a two dimensional 2 d surface called a texture map is wrapped around a three dimensional 3 d object thus the 3 d object acquires a surface texture similar to that of the 2 d surface. Uv mapping is the 3d modeling process of projecting a 2d image to a 3d model s surface for texture mapping the letters u and v denote the axes of the 2d texture because x y and z are already used to denote the axes of the 3d object in model space while w in addition to xyz is used in calculating quaternion rotations a common operation in computer graphics.
Texture mapping a method of adding realism to a computer generated graphic an image the texture is added mapped to a simpler shape that is generated in the scene like a decal pasted to a flat surface. In order to map the texture to a triangle or another polygon we have to tell each vertex which part of the texture it corresponds to. Put very simply this means taking a square image and stretching it over the surface of a 3d object. A texture is a 2d image even 1d and 3d textures exist used to add detail to an object.
Texture mapping originally referred to diffuse mapping a method that simply mapped pixels from a texture to a 3d surface wrapping the image around the object.