Similar presentations

3
Why Texture Map? So far we have done flat shading and Gouraud/Phong shading Not good to represent everything in real world What are some of our other options? Represent everything with tiny polygons Geometry would get complicated very quickly Apply textures across the polygons This allows for less geometry but the image looks almost as good

4
Basic Concept Textures are almost always rectangular array of pixels called texels (texture elements) Pasting an image onto a model An image is mapped onto the 2D domain of a 3D model

5
Texture Coordinates A texture is usually addressed by two numbers (s, t) s and t takes values in [0,1] A vertex can be associated with a point on the texture by giving it one of these texture coordinates glTexCoord*(s,t); glVertex*(x,y,z); s t [0,0] [1, 0] [0, 1]

17
Proper Interpolation a cooresponds to A which maps to texture (Sa, Ta) b corresponds to B which maps to texture ( Sb, Tb) left = lerp(a,b,f) s left(y) =lerp(S A /a4, S B /b4, f) / lerp( 1/a4, 1/b4, f) Similar for t left(y) and right pixel Similar hyperbolic interpolation for intermediate pixels a b a’ b’ y left right

18
Texture Maps and Visual Realism Three different visual effects: 1. Glowing objects – Intensity is set equal to the texture value: I = texture(s,t) – Object appears to emit light or glow – Color can be added by considering the red, green and blue components separately 2. Modulate reflection coefficients – Make texture appear to be painted on the surface – Change the reflection coefficients at each point by: 3. Bump mapping – Model the roughness of the surface

19
Bump Mapping

20
Use texture map to perturb surface normal Use texture array to set a function which perturbs surface normal Apply illumination model using perturbed normal

22
Bump Mapping The ‘perturbed’ surface becomes: To find the new normal m´(u,v) –Find two vectors tangent to the bumpy surface, then m´(u,v) is their cross product –The two vectors follow from the partial derivatives of the P´(u,v) equation wrt u,v

23
Wrapping Texture on Curved Surfaces Wrap a label around a cylinder Wrap a label onto a sphere