Texture Mapping Jung Lee
*Edwin Catmull, Ph.D. Thesis, 1974 Texture Mapping* Adds visual detail to surfaces of 3D objects
Texture Mapping Example
Texture and Texel Texel : Texture Element Texture Coordinates (s, t) GPUs can handle usually 2m x 2n texels Where m and n are nonnegative integers Texture Coordinates (s, t)
2D Texture Space Continuous (s, t) Coordinate Space [0, 1] For mapping it into a discrete texture image space [Texture Map] [2D Texture Image]
Texture Mapping Overview 1. Define a texture image 2. Specify mapping from the texture to surface Texture coordinate 3. Lookup texture values during scan conversion (0, 1) (1, 0) t v s u (0, 0) y x
Texture Value Lookup Bilinearly interpolate texture coordinates In the scan conversion step α β (u1, v1) (u3, v3) (u2, v2)
Texture Modulation Texture Shaded Color Texture Shading
Bump Mapping Perturbs surface normal vectors Normal Information So called ‘normal mapping’ Normal Information Normal information can be stored in a RGB image Convert (x, y, z) to (R, G, B)
Bump Mapping Example (1/5) [Bump Mapped Sphere]
Bump Mapping Example (2/5)
Bump Mapping Example (3/5)
Bump Mapping Example (4/5)
Bump Mapping Example (5/5) 4M Triangles 500 Triangles
Displacement Mapping Modifying the actual surface geometry
How to Assign Normal Vectors in OpenGL Face Normal Vector Vertex Normal Vector N(a, b, c) glBegin(GL_POLYGON); glNormal3f(a, b, c); glVertex3f(x1, y1, z1); glVertex3f(x2, y2, z2); glVertex3f(x3, y3, z3); glEnd(); P1(x1, y1, z1) P2(x2, y2, z2) P3(x3, y3, z3) N1(a1, b1, c1) glBegin(GL_POLYGON); glNormal3f(a1, b1, c1); glVertex3f(x1, y1, z1); glNormal3f(a2, b2, c2); glVertex3f(x2, y2, z2); glNormal3f(a3, b3, c3); glVertex3f(x3, y3, z3); glEnd(); N2(a2, b2, c2) P1(x1, y1, z1) N3(a3, b3, c3) P2(x2, y2, z2) P3(x3, y3, z3)
Environment Mapping Maps a surrounding environment texture Around a surface of an object To approximate effects like reflection or refraction View dependant Due to reflective mapping process Not need the texture coordinates Since surface normals are used to map the environment texture Cubic Environment Mapping Spherical Environment Mapping
Cubic Environment Mapping
Environment Mapping Example