texture mapping
play

Texture Mapping CS418 Computer Graphics John C. Hart Interpolation - PowerPoint PPT Presentation

Texture Mapping CS418 Computer Graphics John C. Hart Interpolation Rasterization will interpolate any vertex 9 attribute across a polygons fragments 8 Interpolating color 7 yields Gouraud smooth 6 shading 5 Can also define


  1. Texture Mapping CS418 Computer Graphics John C. Hart

  2. Interpolation • Rasterization will interpolate any vertex 9 attribute across a polygon’s fragments 8 • Interpolating color 7 yields Gouraud smooth 6 shading 5 • Can also define texture 4 coordinates (u,v) at vertices that, when 3 interpolated, map an 2 image onto a meshed 1 surface 0 0 1 2 3 4 5 6 7 8 9

  3. Texture Mapping 1 v 0 0 u 1

  4. Texture Mapping 1 .7 .6 v (.1,.7) (.2,.6) 0 0 u 1 .1 .2

  5. Perspective z y top z front z half z back Correction v half v back v front • In this example: v d – y = -1, d = 1 and v = -z y canvas = y /(- z / d ) = y / w – v back maps to y top = -1/- z back – v half maps to y half = -1/- z half – v front maps to y bottom = -1/-z front • So need to interpolate inverse u = x v = z • clip verts + attrs: ( x , y , z , w , u , v , 1 ) • canvas vertices and attributes: (-2,-1,0) (2,-1,0) ( x / w , y / w , z / w , 1/ w , u / w , v / w ) • interpolate: ( u / w , v / w , 1/ w ) • divide per-pixel by 1/ w to get interpolated (u,v)

  6. Example y canvas = y /(- z / d ) = y / w u/w = 1/9 -9 u = 1.0 1/w = 1/9 -5 -3 u/w = .5/9 u = 0.1 1/w = 5/9 -1 u/w = 0 u = 0.0 1/w = 1 (0,0,0) 1 3 5 7 9 z = -1 -3 -5 -7 -9 y = -1 -1 -1 -1 -1 w = 1 3 5 7 9 u = 0 .25 .5 .75 1

  7. Magnification Aliasing • “Jaggies” – lines have a staircased edge appearance • Occur when a single texture sample (texels) projects to multiple screen pixels • (Also occurs when rasterizing lines or polygon edges)

  8. Bilinear Filtering • “Jaggies” – lines have a staircased edge appearance • Occur when a single texture sample (texels) projects to multiple screen pixels • (Also occurs when rasterizing lines or polygon edges) • Fixed by averaging neighboring samples to find the value between samples

  9. Minification Aliasing • Many texture pixels (texels) map into a single screen pixel • Cannot simply add them up because some pixels would take longer than others to add

  10. MIP Mapping • Many texture pixels (texels) map into a single screen pixel • Cannot simply add them up because some pixels would take longer than others to add • Create an image pyramid from the initial texture • Each level of the pyramid half the resolution of the one below it • Choose the texture resolution whose projected texel size most closely matches pixel size

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend