Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 51 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
51
Dung lượng
9,56 MB
Nội dung
Texture Mapping Texture Mapping • Important topic: nearly all objects textured – Wood grain, faces, bricks and so on – Adds visual detail to scenes • Meant as a fun and practically useful lecture Polygonal model With surface texture Adding Visual Detail • Basic idea: use images instead of more polygons to represent fine scale color variation Parameterization + geometry = image texture map Q: How we decide where on the geometry each color from the image should go? Option: Varieties of projections [Paul Bourke] Option: unfold the surface [Piponi2000] Option: make an atlas charts atlas surface [Sander2001] Option: it’s the artist’s problem OPENGL TEXTURE MAPPING OpenGL Texture Mapping • Apply a 1D, 2D, or 3D image to geometric primitives • Uses of Texturing – – – – Simulating materials Reducing geometric complexity Image warping Reflections 10 Texture Residency • Working set of textures – – – – high-performance, usually hardware accelerated textures must be in texture objects a texture in the working set is resident for residency of current texture, check GL_TEXTURE_RESIDENT state • If too many textures, not all are resident – can set priority to have some kicked out first – establish 0.0 to 1.0 priorities for texture objects 37 TEXTURE MAPPING APPLICATIONS 38 Texture Mapping Applications • • • • • • Modulation, light maps Bump mapping Displacement mapping Illumination or Environment Mapping Procedural texturing And many more 39 Modulation textures Wood texture Map texture values to scale factor Texture value I T ( s, t )( I E K A I A L ( K D ( N L) K S (V R) n ) S L I L K T I T K S I S ) 40 Bump Mapping • Texture = change in surface normal! Sphere w/ diffuse texture Swirly bump map Sphere w/ diffuse texture and swirly bump map 41 Displacement Mapping 42 Illumination Maps • Quake introduced illumination maps or light maps to capture lighting effects in video games Texture map: Light map Texture map + light map: 43 Environment Maps mages from Illumination and Reflection Maps: Simulated Objects in Simulated and Real Environments Gene Miller and C Robert Hoffman SIGGRAPH 1984 “Advanced Computer Graphics Animation” Course Notes 44 Solid textures • Texture values indexed by 3D location (x,y,z) • Expensive storage, or • Compute on the fly, e.g Perlin noise 45 Procedural Texture Gallery 46 47 48 49 50 51 ... Specify textures in texture objects Set texture filter Set texture function Set texture wrap mode Set optional perspective correction hint Bind texture object Enable texturing Supply texture. .. names for texture objects in the array texIds • Delete texture objects glDeleteTextures(n, texIds[]) 22 Texture Objects (cont.) • Create texture objects with texture data and state glBindTexture(target,... glTexParameteri(GL _TEXTURE_ 2D, GL _TEXTURE_ WRAP_S, GL_CLAMP) glTexParameteri(GL _TEXTURE_ 2D, GL _TEXTURE_ WRAP_T, GL_REPEAT) t s texture GL_REPEAT wrapping GL_CLAMP wrapping 33 Texture Functions • Controls how texture