texture mapping - cs.ucr.educraigs/courses/2018-fall-cs... · environment maps bump maps opacity...
TRANSCRIPT
![Page 1: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/1.jpg)
Texture Mapping
University of California Riverside
![Page 2: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/2.jpg)
Limits of geometric modeling
Although modern GPUs can render millions oftriangles/sec, that’s not enough sometimes. . .
![Page 3: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/3.jpg)
Texture mapping for detail
This image contains 8 polygons!
![Page 4: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/4.jpg)
Texture mapping comparison
no texture with texture
![Page 5: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/5.jpg)
Pixar - Toy Story
![Page 6: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/6.jpg)
Other uses of textures. . .
Light maps
Shadow maps
Environmentmaps
Bump maps
Opacity maps
Animation
![Page 7: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/7.jpg)
Lookup reflectances in image
Image source: [1, 2]
![Page 8: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/8.jpg)
Texture mapping in the pipeline
Geometry and pixels have separatepaths through pipelineTextures applied in fragment shader
End of pipelineEfficient since relatively few polygonsget past clipper
vertex input
vertex shader
tessellation
geometry shader
post vertex processing
primitive assembly
rasterization
fragment shader
per-sample operations
![Page 9: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/9.jpg)
uv Mapping
2D texture is parameterized by (u, v)
Assign polygon vertices texture coordinates
Interpolate within polygon
(u0, v0)(u1, v1)
(u2, v2)
![Page 10: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/10.jpg)
![Page 11: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/11.jpg)
Texturing triangles
Store (u, v) at each vertex
Interpolate inside triangles using barycentriccoordinates
u
v 1, 10, 1
0, 0 1, 0
(0.4, 0.2)
(0.8, 0.4)
A
B C
a
bc
Texture Space Object Space
(u,v) = (0.2, 0.8)
![Page 12: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/12.jpg)
Texturing triangles
Store (u, v) at each vertex
Interpolate inside triangles using barycentriccoordinates
p(β, γ) = pa + β(pb − pa) + γ(pc − pa)
u(β, γ) = ua + β(ub − ua) + γ(uc − ua)
v(β, γ) = va + β(vb − va) + γ(vc − va)
![Page 13: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/13.jpg)
Texture mapping
![Page 14: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/14.jpg)
Point sampling
Map back to texture image and use the nearest texel
![Page 15: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/15.jpg)
Aliasing
Point sampling textures can lead to aliasing artifacts
![Page 16: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/16.jpg)
Magnification and minification
Minification
Magnification
![Page 17: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/17.jpg)
Aliasing artifacts
We apply filtering toreduce aliasing
artifacts
![Page 18: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/18.jpg)
Area averaging
A better but slower option is to use area averaging
![Page 19: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/19.jpg)
Use bilinear filtering
nearestneighbor
bilinear bicubic
P0 P1
P2 P3
P
mitigate magnification artifacts
![Page 20: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/20.jpg)
Mipmapping
Reduce minification artifacts
Prefilter the texture to obtainreduced resolutions
Requires 13 more space
Get a texture hierarchyindexed by level
![Page 21: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/21.jpg)
pointsampling
linearfiltering
mipmappedpoint
sampling
mipmappedlinear
filtering
![Page 22: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/22.jpg)
pointsampling
linearfiltering
mipmappedpoint
sampling
mipmappedlinear
filtering
![Page 23: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/23.jpg)
Environment mapping
![Page 24: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/24.jpg)
Environment mapping
Use a texture for the distant environmentsimulate the effect of ray tracing more cheaply
![Page 25: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/25.jpg)
Sphere mapping
Project objects in the environment ontosphere centered at eye
Unwrap and store as texture
Use reflection direction to look up texturevalue
![Page 26: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/26.jpg)
Cube mapping
Compute six projections, one for each wall
Store as texture
Use reflection direction to lookup texturevalue
![Page 27: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/27.jpg)
Different environment maps
Blinn/Newelllatitude mapping spherical mapping cube mapping
![Page 28: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/28.jpg)
Environment mapping
Create the effect of a mirror with two-passrendering
First pass: render the scene from theperspective of the mirror
Second pass: render from original pov; use thefirst image as a texture for the mirror
![Page 29: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/29.jpg)
Bump mapping
![Page 30: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/30.jpg)
![Page 31: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/31.jpg)
bump mapping geometric detail
![Page 32: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/32.jpg)
Normal mapping
![Page 33: Texture Mapping - cs.ucr.educraigs/courses/2018-fall-cs... · Environment maps Bump maps Opacity maps Animation. Lookup re ectances in image Image source: [1, 2] Texture mapping in](https://reader035.vdocuments.us/reader035/viewer/2022081601/6112d4a792f8da74a83c4408/html5/thumbnails/33.jpg)
Attribution
[1] vort. Cellulartexture.png. https://commons.wikimedia.org/wiki/File:CellularTexture.png. CCBY-SA 3.0.
[2] Wiksaidit. Procedural texture.jpg.https://commons.wikimedia.org/wiki/File:Procedural Texture.jpg. CC BY-SA 3.0.