9 Textures v Create the illusion of detail



















- Slides: 19
9. Textures v Create the illusion of detail by wraping a complex image (texture) around a simple geometry – realism is increased without the need for a complex shape continued Texture Mapping 1
Textures 2
Open. GL Pipeline Overview Diagram Open. GL Reference Manual (Addison-Wesley Publishing Company) 3
Textures Express a image or complex objects v How to present wall or tree v – Geometry and color? ? – Texture!! 4
Textures v Basic Principles v Create a Simple Texture 5
Textures Objectives v Know what a texture is and why we need it. v Be able to program simple textures. 6
Textures Basic Principles v Detailed surface structures are hard and expensive to build in 3 D -> Texture! v „Texel“ is „texture element“ -> one pixel of a texture. v Texture mapping: Fit image to a given geometry. 7
Textures Create a Simple Texture v Load an image String filename = "earth. jpg"; Texture. Loader loader = new Texture. Loader(filename, this); Image. Component 2 D image = loader. get. Image(); v Create a texture Texture 2 D texture = new Texture 2 D(Texture. BASE_LEVEL, Texture. RGBA, image. get. Width(), image. get. Height()); texture. set. Image(0, image); v Create 3 D- Appearance appear = new Appearance(); appear. set. Texture(texture); object with appearance Sphere earth = new Sphere(1. 0 f, Primitive. GENERATE_TEXTURE_COORDS, appear)); 8
Java 3 D Textures v Texture. Loader class v Tex. Coord. Generation class v Texture 2 D class v Texture 3 D class 9
Adding Texture v Adds high-frequency detail that would be unreasonable to achieve through polygons and color 10
11
12
13
Textures Artist creates Bitmaps v “wrap the bitmap around the model” via UV Mapping v 14
UV Mapping v Cutting, Stretching, Rotating a flat texture to project on a 3 D surface v Texture Exists in (u, v) space v Model’s polygons carry (u, v) coordinates in addition to (xyz) v Use tools to assign the proper (u, v) pairs to each polygon 15
v 0. 5, 1. 0 0, 0 1. 0, 0. 5 0, 0 u 1. 0, 0. 5, 1. 0 16
v 2 D and 3 D textures are supported v Textures an be attached to shapes in a variety of predefined ways, or linked to specific coordinates in the shape. 17
Texture Mapping v Wrap and Clamp v Filtering – – Texel to pixel Magnification Minification MIPmaps 18
Texture Coordinate Generation v Tex. Coord. Generation class – Automatically generate texture coordinates. – Linear Projection – Sphere Map 19