计算机图形学computer graphics课件18.ppt
《计算机图形学computer graphics课件18.ppt》由会员分享,可在线阅读,更多相关《计算机图形学computer graphics课件18.ppt(59页珍藏版)》请在三一文库上搜索。
1、Texture Mapping,Software College, Shandong University Instructor: Zhou Yuanfeng E-mail: ,2,3,Objectives,Introduce Mapping Methods Texture Mapping Environment Mapping Bump Mapping Consider basic strategies Forward vs backward mapping Point sampling vs area averaging,4,The Limits of Geometric Modeling
2、,Although graphics cards can render over 10 million polygons per second, that number is insufficient for many phenomena Clouds Grass Terrain Skin, hair Water and fire,5,Modeling an Orange,Consider the problem of modeling an orange (the fruit) Start with an orange-colored sphere Too simple Replace sp
3、here with a more complex shape Does not capture surface characteristics (small dimples) Takes too many polygons to model all the dimples,6,Modeling an Orange (2),Take a picture of a real orange, scan it, and “paste” onto simple geometric model This process is known as texture mapping Still might not
4、 be sufficient because resulting surface will be smooth Need to change local shape Bump mapping,+,7,Three Types of Mapping,Texture Mapping Uses images to fill inside of polygons Environment (reflection mapping) Uses a picture of the environment for texture maps Allows simulation of highly specular s
5、urfaces Bump mapping Emulates altering normal vectors during the rendering process,8,Texture Mapping,geometric model,texture mapped,9,Environment Mapping,10,Bump Mapping,+,=,original surface,bump map,modified surface,11,Where does mapping take place?,Mapping techniques are implemented at the end of
6、the rendering pipeline Very efficient because few polygons make it past the clipper,12,Is it simple?,Although the idea is simple-map an image to a surface-there are 3 or 4 coordinate systems involved,2D image,3D surface,13,Coordinate Systems,Parametric coordinates May be used to model curves and sur
7、faces Texture coordinates Used to identify points in the image to be mapped Object or World Coordinates Conceptually, where the mapping takes place Window Coordinates Where the final image is really produced,14,Texture Mapping,parametric coordinates,texture coordinates,world coordinates,window coord
8、inates,15,Mapping Functions,Basic problem is how to find the maps Consider mapping from texture coordinates to a point a surface Appear to need three functions x = x(s,t) y = y(s,t) z = z(s,t) But we really want to go the other way,s,t,(x,y,z),16,Backward Mapping,We really want to go backwards Given
9、 a pixel, we want to know to which point on an object it corresponds Given a point on an object, we want to know to which point in the texture it corresponds Need a map of the form s = s(x,y,z) t = t(x,y,z) Such functions are difficult to find in general,Parameterization,17,18,Two-part mapping,One s
10、olution to the mapping problem is to first map the texture to a simple intermediate surface Example: map to cylinder,19,Cylindrical Mapping,parametric cylinder,x = r cos (2pi u) y = r sin (2pi u) z = v/h,maps rectangle in u,v space to cylinder of radius r and height h in world coordinates,s = u t =
11、v,maps from texture space,Cylindrical Mapping,20,Mapping:,Cylindrical Mapping,21,Map u and v to points a,b,c,d: (1) : (2) : (3) : (4) : Solving: From texture to cylindrical parameters: From cylindrical parameters to texture:,22,Spherical Mapping,We can use a parametric sphere,x = r cos 2piu y = r si
12、n 2pu cos 2piv z = r sin 2pu sin 2piv,in a similar manner to the cylinder but have to decide where to put the distortion Spheres are used in environmental maps,23,Box Mapping,Easy to use with simple orthographic projection Also used in environment maps,Polycube mapping,24,Conformal mapping,In mathem
13、atics, a conformal map is a function which preserves angles.,25,26,Second Mapping,Map from intermediate object to actual object Normals from intermediate to actual Normals from actual to intermediate Vectors from center of intermediate,intermediate,actual,27,Aliasing,Point sampling of the texture ca
14、n lead to aliasing errors,point samples in u,v (or x,y,z) space,point samples in texture space,miss blue stripes,28,Area Averaging,A better but slower option is to use area averaging,Note that preimage of pixel is curved,pixel,preimage,Catmull texture mapping,Surface subdivision,29,Continuous mappin
15、g,30,(a) Spherical Mapping (b)Cylindrical Mapping,Mip-map (1983, Lance Williams),31,Mip-map,Actually mip-map is a lookup table for texture,32,OpenGL Texture Mapping,34,Basic Strategy,Three steps to applying a texture specify the texture read or generate image assign to texture enable texturing assig
16、n texture coordinates to vertices Proper mapping function is left to application specify texture parameters wrapping, filtering,35,Texture Mapping,image,geometry,display,36,Texture Example,The texture (below) is a 256 x 256 image that has been mapped to a rectangular polygon which is viewed in persp
17、ective,37,Texture Mapping and the OpenGL Pipeline,Images and geometry flow through separate pipelines that join at the rasterizer “complex” textures do not affect geometric complexity,38,Define a texture image from an array of texels (texture elements) in CPU memory Glubyte my_texels512512; Define a
18、s any other pixel map Scanned image Generate by application code Enable texture mapping glEnable(GL_TEXTURE_2D) OpenGL supports 1-4 dimensional texture maps,Specifying a Texture Image,1D texture mapping,39,1D texture mapping,unsigned char colorbar1024; glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA, 256, 0,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机图形学computer graphics课件18 计算机 图形学 computer graphics 课件 18
链接地址:https://www.31doc.com/p-3064713.html