Top Banner

Click here to load reader

of 35

Texture mapping

Jan 13, 2015

ReportDownload

Education

wahab13

Computer Graphics

  • 1. Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass, wall paper. Use geometry, model surface detail with polygons; good for large scale detail, too expensive otherwise. Improvement: map an image of the details onto simple geometry 1

2. The wall2 3. The wall3 4. The Wall: Brick4 5. The Wall: Checkers5 6. Texture Mapping y zxgeometrytscreenimage s6 7. Texture Mapping Images and geometry flow through separate pipelines that join at the rasterizer complex textures do not affect geometric complexityverticesgeometry pipeline rasterizerimagepixel pipeline 7 8. Texture mapping Texture mapping: adding surface detail by mapping texture patterns to the surface Technique developed by Catmull (1974), Blinn and Newell (1976).8 9. Texture mapping methods 2D texture mapping: paint 2D pattern onto the surface Environmental (reflection) mapping Bump mapping: Disturb surface normal to fool shading algorithms Procedural texture mapping, 3D texture9 10. More Examples10 11. Environment Mapping11 12. 2D texture mapping overview Texture array is a 2D image pattern With elements texels Value at a texel affects surface appearance The texture map determines how the pattern lies on the surface12 13. 2D texture mapping overview Rendering uses the texture mapping Find surface that is front most at current pixel Find the surface patch corresponding to the pixel Find the part of the texture pattern corresponding to the surface patch Use that part of the texture pattern in setting the pixel color 13 14. 14 15. 2D texture mapping Source: 2D pattern from drawing, photo, procedure Destination: any surface, easier if surface given in parametric form The map from 2D texture coord; to 3D object Texture mapping transformation: 2D screen coord; 3D object coord; 2D texture coord; and back (see previous slide)15 16. Mapping the 2D texture to the surface The map: 2D texture(s,t) 3D object(x,y,z) Mapping onto triangle is not difficult Mapping onto triangular mesh is more difficult (have to handle texture discontinuity) Mapping onto parametric surface is easier Alternative: use an intermediate parametric surface (cylinder, sphere)16 17. Mapping a Texture t 0, 1Based on parametric texture coordinates glTexCoord*() specified at each vertex Texture Space 1, 1(s, t) = (0.2, 0.8) Aab 0, 0Object Spacec(0.4, 0.2) B 1, 0sC (0.8, 0.4) 17 18. Mapping texture onto parametric surface Point on the parametric surfacep : x = x(u , v), y = y (u , v), z = z (u , v)18 19. Mapping texture onto parametric surface using liner mapThe map from texture to the parametric coord using invertible linear map between the texture space (s,t) and the domain (u,v)p : x = x(u , v), y = y (u , v), z = z (u , v)u = as + bt + c v = ds + et + f 19 20. Mapping texture onto parametric surface, exampleDoes not take into account curvature of surface Equal size texture patches are stretched to fit various areas20 21. Mapping texture to a surface using an intermediate surface Two-step mapping Map the texture to a simple intermediate surface (sphere, cylinder, cube) Map the intermediate surface (with the texture) onto the surface being rendered21 22. Two-step mapping exampleparametric form cylinder: x = r cos(2 PI u) y = r sin(2 PI u) z=vh 0