Texture Mapping 2 D Texturing CSE 681 Texture

  • Slides: 15
Download presentation
Texture Mapping: 2 D Texturing CSE 681

Texture Mapping: 2 D Texturing CSE 681

Texture Mapping Visual complexity on demand Vary display properties over object Visible pixel maps

Texture Mapping Visual complexity on demand Vary display properties over object Visible pixel maps to location on object Location on object used to lookup display attributes Or as function parameters to generate attributes CSE 681

2 D Texture Mapping Usually a 2 D rectangular image or function Parameterize using

2 D Texture Mapping Usually a 2 D rectangular image or function Parameterize using (u, v) texture coordinates texture v u CSE 681

2 D Texture Mapping Need to parameterize surface similar to texture sphere quadrilateral u

2 D Texture Mapping Need to parameterize surface similar to texture sphere quadrilateral u v v u latitude - longitude CSE 681 bilinear interpolation

Texture as table of values texture Table of values 0, 0 0, m-1 v

Texture as table of values texture Table of values 0, 0 0, m-1 v u n-1, 0 n-1, m-1 Values at grid intersections CSE 681

For sphere Texture Map Coordinates 1 v 0 World Space 0 u Map (x,

For sphere Texture Map Coordinates 1 v 0 World Space 0 u Map (x, yz) to u, v space to table values CSE 681 1

For sphere map sphere surface to (u, v) 1 q z 1 0 x

For sphere map sphere surface to (u, v) 1 q z 1 0 x y a x 0 BUT Has a seam & distorts CSE 681

For quadrilateral Texture Map Coordinates 1 v 0 World Space 0 u Map (x,

For quadrilateral Texture Map Coordinates 1 v 0 World Space 0 u Map (x, yz) to u, v space to table values CSE 681 1

World space point to u, v space P 1, 0 P 1, 1 P

World space point to u, v space P 1, 0 P 1, 1 P 0, 0 CSE 681 P 0, 1

1 u, v space to table indice space 0 0 v 1 u n-1

1 u, v space to table indice space 0 0 v 1 u n-1 s CSE 681 0 0 u 1

A closer look (s, t) World Space Values only at the intesections What value

A closer look (s, t) World Space Values only at the intesections What value to use at non-intersection point? CSE 681

Closer still Use closest value? tx[i+1][j] tx[i+1][j+1] (s, t) tx[i][j] tx[i][j+1] CSE 681

Closer still Use closest value? tx[i+1][j] tx[i+1][j+1] (s, t) tx[i][j] tx[i][j+1] CSE 681

Closer still t[i+1][j] t[i+1][j+1] Interpolate 4 closest? (s, t) t[i][j] t[i][j+1] CSE 681

Closer still t[i+1][j] t[i+1][j+1] Interpolate 4 closest? (s, t) t[i][j] t[i][j+1] CSE 681

(Pixel) size matters World Space Can’t just use pixel center and expect good results

(Pixel) size matters World Space Can’t just use pixel center and expect good results in all cases - need to consider how entire pixel maps into texture space CSE 681

One solution: Mip-mapping Pre-filter texture, reducing resolution (increase size of grid relative to pixel

One solution: Mip-mapping Pre-filter texture, reducing resolution (increase size of grid relative to pixel size) Successive table of values (r, g, b) at reduced resolution Down to single pixel Index into highest resolution one in which bilinear interpolation makes sense CSE 681