340 likes | 630 Views
Texturing. Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using An image A function Other dataset Gained importance in 80’s; enhance Phong shaded scenes
E N D
Texturing • Surface’s texture: its look & feel • Graphics: a process that takes a surface and modifies its appearance using • An image • A function • Other dataset • Gained importance in 80’s; enhance Phong shaded scenes • Environment mapping: Reflect the surrounding environments into shiny animated objects Dinesh Manocha, COMP770
Mapping Techniques: Texture and Environment Mapping • Texture: A 2D image or pattern • Goal: Map the texture or detail onto a 3D object • Mapping: Finding two u,v values from three values from one of the 3-D coordinate spaces: R3 -> R2 Dinesh Manocha,
Main Issues in Texture Mapping • Anti-aliasing • What attribute or parameter of the model is to be modulated? • How is texture mapping carried out? Define a mapping between the 2D domain of texture maps and 3D object domain Dinesh Manocha
Modulating Different Parameters • Surface color: Modulating the diffuse coefficient. Most common [Catmull1974] • Specular & Diffuse Reflection (Environment mapping) [Blinn 1976] • Normal Vector Perturbation: Perturbs the surface normal [Blinn 1978]. Extended to frame mapping (tangent, normal, binormal) [Kajiya1985] Dinesh Manocha
Modulating Different Parameters [Heckbert1986: Review Paper, IEEE CG & A] • Specularity: Surface roughness function in the Cook-Torrance reflection model (variable shininess) [Blinn1978] • Transparency: Doesn’t apply texture to an object, but generates a complete object: a cloud using a mathematical texture function to modulate the transparency of an ellipsoid Dinesh Manocha
Main Approaches and Categories • General texture mapping: a 2D texture domain is pasted onto the object • View-dependent mapping techniques: e.g. chrome, environment, reflection and refraction • Bump mapping techniques: Alters the geometry of the surface Dinesh Manocha
Texture Mapping and Object Representation • Polygonal models: The mapping or the projection function needs to be computed • Pasting: Cannot paste a 2D pattern onto a polygonal object of arbitrary topology without cutting the pattern • Parametric analytic models: computing the mapping function is relatively simple (e.g. rational parametric surfaces) Dinesh Manocha
Texture Mapping Pipeline • Compute object space location (x,y,z) • Use mapping function to find (u,v) • Use corresponder function(s) to compute texel • Apply value transform function • Modify illumination equation value
Practical Approach for Polygonal Models Associate a texture map coordinate (u,v) with each vertex of the polygonal mesh • Derive a mapping or projection function F() such that: (u,v) = F(x,y,z) • Develop algorithms for associating texture values internal to the polygon, as it gets clipped and rendered. Dinesh Manocha,
Standard mapping or projection functions • Cylindrical mapping function • Spherical mapping function • Box mapping function • Planar projections
Mapping during Modeling • Object is approximately cylindrical or spherical (e.g. bananas) • Bend the objects without changing the mapping function to the vertices Dinesh Manocha
Texture Mapping Pipeline • Compute object space location (x,y,z) • Use mapping function to find (u,v) • Use corresponder function(s) to compute texel • Apply value transform function • Modify illumination equation value Dinesh Manocha
Corresponder Functions • Transform the parameter space values (u,v) into a texture space value (texels) • Examples: • array indices into an image texture (sampling, anti-aliasing, mipmapping) • Optional matrix transformation (OpenGL): rotate, scale • Image application: warp, repeat, mirror • Can apply multiple corresponder functions Dinesh Manocha
Texture Application • RGB or RGB\alpha, where \alpha is the opacity value • Change surface attribute using texture blending functions • Replace: Replace the original color with texture color • Modulate: Multiply the surface color by texture color Dinesh Manocha
Other Mappings or Visual Representations • Volume textures: Evaluated on any point in space • Hypertexture: volumetric modeling technique • Texel-mapping: Maps an entire surface description onto the surface of an object • Displacement Maps: Moves the surface by a given amount in a given direction Dinesh Manocha
Reverse Mapping Techniques Active area of research • Optimization methods • Harmonic maps • Divide-and-conquer approaches • Multi-resolution approaches • A huge literature on surface parameterization over last 10 years Dinesh Manocha
Mapping Polygon Interior Points Associate (u,v) values with the interior of the polygon • Simple solution: Include the (u,v) coordinates with the screen coordinates and normals. Use Phong interpolation approach. Dinesh Manocha
Mapping Polygon Interior Points: Known Projection Function • Compute the function as the polygon is clipped and rendered • Transform the vertices of the clipped polygon to the object space • Apply the projection function to the transformed vertices to compute the texture coordinates Dinesh Manocha
Environment Mapping • Approximation to ray tracing • Object is surrounded by a closed 3D surface onto which the environment is projected • Used for seeing recognizable detail in the reflected information Dinesh Manocha
Location in the Environment Mapping the environment to inside of a large sphere • Trace a ray from the eye-point to the surface of the rendered object • Reflect the ray about the normal and trace the ray to the sphere • Greater distortion: The farther an object is from the eye-point or larger the object Dinesh Manocha
Mapping to a Large Cube [Greene86] • Explicit representation by 6 raster images • Take six separate, appropriately oriented photographs of the scene, using a 900 flat field lens • Project the photographs onto the six inside faces of the cube • Can combine Lambertian diffuse and specular reflection in the environment map • Mapping function is not spherical and has less distortion Dinesh Manocha
Rough Appearance • Texture Mapping: Adding texture patterns to smooth surfaces. • Rough Appearance: Adding rough-texture pattern to a smooth surface? Dinesh Manocha
Bump Mapping • Perturb the surface normal [Blinn76] • Given Q(u,v), let the surface normal be n, where n = Qu X Qv, and let n be the normalized unit vector • For any point on Q(u,v), the position vector is: Q’(u,v) = Q(u,v) + P(u,v) n, where P(u,v) is a perturbation function. • The normal of the perturbed surface is: n + Pu (n X Qv) + Pv (Qu X n) Dinesh Manocha
Choice of Perturbation Function • Any first order continuous function • Examples: grid pattern, character bit maps, Z-buffer patterns, random hand-drawn patterns • Nonmathematical patterns: The perturbation function is a 2D lookup table. Derivatives are computed by table lookup. Dinesh Manocha
Procedural Textures (Solid Textures) • Define a texture function throughout a 3D volume • Object is embedded in the 3D texture volume • Textured surface: intersection of the object and 3D texture volume • Coherent appearance with no texture discontinuities • Independent of surface geometry or coordinate system Dinesh Manocha
Procedural Textures (Wood Grain Examples) • Coaxial alternating light and dark cylinders • Lack of distortion or aliasing Dinesh Manocha
Other Issues in Texture Mapping • Magnification (use of bilinear interpolation) • Minification • Sampling and filtering (aliasing problems) • Use of mipmapping for anti-aliasing • Texture caching and compression (limited texture memory) • Multitexturing (and multi-pass rendering): two or more textures are accessed during the same pass Dinesh Manocha
Texture Antialiasing • Aliasing is a constant aspect of texture mapping • Frequency domain analysis: silhouette edges and perspective can cause high frequency patterns in image space • Point sampling (mapping the center of image pixel to texture space and use the nearest texture pixel) a texture pattern can generate lots of aliasing problems: • Wide literature on different filters to circumvent the problem Dinesh Manocha
Mip-mapping • Generates many images of decreasing resolution by averaging multiple pixels • Original image and the averaged lower resolution images are stored in multiple tables • Equivalent to convolution with a square box filter • Stacking the mipmaps in 3 space forms a pyramid • Memory: 4/3 times the original texture image • Widely used texture filtering method: fast and little memory Dinesh Manocha
Summed Area Tables • Extension of mipmaps to rectangular texture regions • Reduce the table to one using summed area table • Each entry: represents the sum of the intensities of all texture pixels in a rectangle defined by lower left corner and the pixel of interest • Average intensity: Divide this by number of pixels • Used summed areas to technique to compute the intensity of each pixel • Prefilter the texture image, using a box filter function prior to summing Dinesh Manocha