Making 3D Textures Practical 1 Introduction
Total Page:16
File Type:pdf, Size:1020Kb
Making 3D Textures Practical Insung Ihm Sanghun Park Chandra jit Ba ja j Department of Computer Science Department of Computer Sciences Sogang University The University of Texas at Austin Seoul, Korea U.S.A. Abstract While 2D texture mapping is one of the most powerful rendering techniques that make 3D ob jects app ear visually interesting, it su ers from the visual artifacts, pro duced when 2D image patterns are wrapp ed onto the surface of ob jects with arbitrary shap es. On the other hand, 3D texture mapping generates highly natural visual e ects in which ob jects app ear carved from lumps of materials rather than laminated with thin sheets as in 2D texture mapping. Storing 3D texture images in a table for fast mapping computations, instead of evaluating pro cedures on the y, however, has b een considered impractical due to the extremely high memory requirements. In this pap er, we present a new e ective metho d for 3D texture mapping, designed for real-time rendering of p olygonal mo dels. Our scheme attempts to resolve the p otential texture memory problem arising from the very large size of 3D images by compressing them using an e ective enco ding metho d. The exp erimental results on various non-trivial 3D textures and p olygonal mo dels show that high compression rates are achieved with few visual artifacts in the rendered image and a small impact on rendering time. The simplicity of our compression-based scheme will make it p ossible to implement, with little e ort, practical 3D texture mapping in software/hardware rendering systems, including the 3D real-time graphics APIs like Op enGL and Direct3D. 1 Intro duction Texture mapping is one of the most p owerful rendering techniques that make three-dimensional ob jects app ear visually more complex and realistic [6 ]. Two-dimensional texture mapping has b een p opular in creating many interesting visual e ects by pro jecting or wrapping 2D image patterns onto the surface of solid ob jects. While it has proved very useful in adding realism in rendering, 2D texture mapping su ers from the limitation that it is often dicult to wrap 2D patterns, without visual artifacts, onto the surface of ob jects having complicated shap es. As an attempt to alleviate the computational complications of wrapping as well as to resolve the visual artifacts, Peachey [12 ] and Perlin [13 ] presented the use of space lling 3D texture images, called solid textures. Many of the textures found in nature such as wood, marble, and gases, are easily simulated with solid textures that map three-dimensional ob ject space to color space [3 ]. Unlike the 2D textures, they exist not only on the surface of ob jects but also inside the ob jects. Texture colors are assigned to any p ointof the entire solid ob ject simply by evaluating the sp eci ed functions or co des according to their p ositions in 3D space. The 3D solid texture mapping can b e viewed as immersing geometric ob jects in virtual volumes asso ciated with 3D textures, and getting necessary texture colors from the solid textures. This 3D texture mapping pro duces highly natural visual e ects in which ob jects app ear carved from lumps of materials rather than laminated on the surfaces as in 2D texture mapping. The di erence between 2D and 3D mapping is prominent particularly when ob jects have complicated geometry and top ology since 3D textures are not visually a ected by the distortions that exist in ob ject parameter space. Many useful 3D textures are generally synthesized pro cedurally instead of painting or digitizing them Refer to [3] for several interesting examples.. They are based on mathematical functions or programs that take 3D co ordinates of p oints as input, and compute their corresp onding texture values. The evaluation is usually carried out on the y during the rendering computation. While pro cedural texture mo dels provide a very compact representation, evaluating pro cedural textures as necessary during texture mapping leads to slower rendering than accessing pre-sampled textures stored in simple arrays. While using sampled 3D texture maps in 3D volumetric form is faster, they tend to take up a large amount of texture memory. For example, a 3D texture has the resolution 256 256 256, its RGB texture requires 48 Mbytes of texture memory. Although some recent graphics systems allow the use of main memory for textures, such memory costs are an imp ossible burden on most current graphics systems. Storing several elab orate textures with high resolution, say, 512 512 512 would b e prohibitiveeven to the most advanced rendering systems. Obviously, there is a tradeo b etween the size of texture memory and the computation time. Explicitly storing sampled textures in dedicated memory, and fetching texture colors as necessary, as in the current graphics accelerator supp orting real-time texture mapping, can generate images faster than evaluating them on the y. To make this feasible for 3D texture mapping, however, ecient solutions for manipulating p otentially huge textures e ectively need to b e devised. This pap er presents a new and practical scheme for real-time 3D texture mapping which is easily implemented. Our technique relies on 3D volume compression and pro cessing from compressed solid textures. The idea of rendering directly from compressed textures has b een presented in the past by [2], where they used vector quantization to compress 2D textures in simple or mip-map form. To compress 3D textures, we use a wavelet-based compression metho d that provides fast deco ding to random data access, as well as fairly high compression rates [1]. This compression technique exploits the p ower of wavelet theory and naturally provides multi-resolution representations of 3D RGB volumes. With this compression metho d, we can store mip-maps for 3D textures of non-trivial resolutions very compactly in texture memory. Its fast random access deco ding ability also results in only a small impact on rendering time. The simplicityof our new 3D texture mapping scheme makes it easy to implement in software/hardware rendering systems. Furthermore, 3D real-time graphics APIs like Op enGL and Direct3D can b e extended with little e ort to include 3D texture mapping without heavy demand for very large texture memories. The rest of this pap er is organized as follows: In Section 2, we provide a detailed description of the new texture mapping technique. Exp erimental results on various 3D textures and p olygonal ob jects are rep orted in Section 3. Finally, we present conclusions and directions for further research in Section 4. 2 A New 3D Texture Mapping Scheme In this section, we describ e a new 3D texture mapping metho d suitable for real-time rendering of p olygonal mo dels. The idea presented here can also be used e ectively in other rendering systems such as RenderMan [14 ] to enhance the texture mapping sp eed. The key p oint in our texture mapping scheme is to extract only the necessary p ortion from the whole 3D texture map, then compress it in compact form where fast run-time deco ding for random access to texel values is p ossible. In particular, the compression metho d we apply is based on wavelet theory, and naturally supp orts multi-resolution representations of 3D textures. This capability of the compression metho d makes it easy to construct 2 Polygonal Model 3D Texture Map Subsection 2.1 3D Texture Modeling Polygonal Model with 3D Texture Subsection 2.2 3D Texture Cell Selection Polygonal Model with Selected 3D Texture Cells Subsection 2.3 3D Texture Compression Polygonal Model with Compressed 3D Texture Subsection 2.4 Polygonal Rendering 3D Textured Image Figure 1: 3D Texture Mapping Pip eline 3 a 3D texture mip-map using a small amount of texture memory. Figure 1 illustrates the 3D texture mapping pip eline in which the rst three steps 3D Texture Mo deling, 3D Texture Cell Selection, and 3D Texture Compression comprise the necessary pre-pro cessing stages. In the following subsections, we provide a detailed explanation of the pip eline. 2.1 3D Texture Mo deling Our scheme assumes, as an input texture, a sampled 3D texture stored in a 3D array. It is generated by sampling texel values from a three-dimensional texture eld that is usually describ ed pro ceduarlly. The storage requirements are very high for uncompressed 3D texture maps at reasonable resolution: 3 3 256 and 512 RGB textures need 48 Mbytes and 384 Mbytes, resp ectively. This is one of the reasons which make fast 3D texture mapping with stored textures app ear impractical. In the texture mo deling stage, a p olygonal ob ject in its ob ject space R = fx; y ; z j x; y; and os z are realg is textured by putting it in a 3D texture de ned in the texture space R = fs; t; r j 0 ts s; t; r 1g, and nding the intersection of the ob ject's surface and the texture. Texturing an ob ject can b e viewed as nding a function f : R ! R . The function map can b e arbitrary. os ts 2.2 3D Texture Cell Selection Once a mapping b etween a p olygonal ob ject and 3D texture is xed, the unnecessary texture data is eliminated to reduce storage space. Consider an n n n texture. In our scheme, the texture data is s t r sub divided into small subblo cks of size n n n , called texturecel ls In our current implementation, c c c the texture cell size is 4 4 4.