cs-184: computer graphics › ~adamb › 435 › slides › texture.pdf · cs-184: computer...
TRANSCRIPT
![Page 1: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/1.jpg)
CS-184: Computer Graphics
Lecture #11: Texture and Other Maps
Prof. James O’BrienUniversity of California, Berkeley
V2008-F-11-1.0
![Page 2: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/2.jpg)
2
Today
Texture Mapping2D
3D
Procedural
Bump and Displacement MapsEnvironment MapsShadow Maps
![Page 3: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/3.jpg)
Surface Detail
Representing all detail in an image with polygons would be cumbersome
3
Specific details
Structured noise
Pattern w/ randomness
Section through volume
Bumps
![Page 4: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/4.jpg)
2D Texture Mapping of Images
Use a 2D image and map it to the surface of an object
4
ColorSpecular
Bump
![Page 5: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/5.jpg)
2D Texture Mapping of Images
Example of texture distortion
5
![Page 6: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/6.jpg)
Texture Coordinates
Assign coordinates to each vertex
Within each triangle use linear interpolation
Correct for distortion!
6
st
![Page 7: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/7.jpg)
MIP Map
Pre-compute filtered versions of the texture
A given UV rate is some level of the texture
Tri-linear filtering UV × map level
7
![Page 8: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/8.jpg)
Procedural Textures
Generate texture based on some function Well suited for “random” textures
Often modulate some noise function
8
![Page 9: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/9.jpg)
Assigning Texture Coordinates
Map a simple shape onto object by projection
Sphere, cylinder, plane, cube
Assign by hand
Use some optimization procedure
9
![Page 10: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/10.jpg)
Repeating Textures
Image Tiles allow repeating texturesImages must be manipulated to allow tilling
Often result in visible artifacts
There are methods to get around artifacts....
10
![Page 11: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/11.jpg)
Repeating Textures
Image Tiles allow repeating texturesImages must be manipulated to allow tilling
Often result in visible artifacts
Artifacts not an issue for artificial textures
11
![Page 12: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/12.jpg)
Non-Color Textures
12
ColorSpecular
Bump
![Page 13: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/13.jpg)
Bump Mapping
13
No bump mapping With bump mapping
Images by Paul Bakerwww.paulsprojects.net
![Page 14: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/14.jpg)
Bump Mapping
Add offset to normalOffset is in texture coordinates S,T,N
Store normal offsets in RGB image components
Should use correctly orthonormal coordinate system
Normal offsets from gradient of a grayscale image
14
b(u,v) = [s, t,n](u,v) = ∇i(u,v)
∇=∂∂u
,∂∂v
�T
![Page 15: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/15.jpg)
Bump Map Example
15
Catherine Bendebury and Jonathan MichaelsCS 184 Spring 2005
![Page 16: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/16.jpg)
Displacement Maps
Actually move geometry based on texture map
Expensive and difficult to implement in many rendering systemsNote silhouette
16Bump Displacement
![Page 17: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/17.jpg)
Environment Maps
Environment maps allow crude reflections
Treat object as infinitesimal Reflection only based on surface normal
Errors hard to notice for non-flat objects
17
![Page 18: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/18.jpg)
Environment Maps
18
![Page 19: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/19.jpg)
Environment Maps
19
x
z
y
u
v
(u,v) = (0,0)x = -y= -z
(u,v) = (1,1)x = y= z
right face has x > |y|, x > |z|
u=y+ x2x
v=z+ x2x
![Page 20: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/20.jpg)
Shadow Maps
20
Pre-render scene from perspective of light source
Only render Z-Buffer (the shadow buffer)
Render scene from camera perspectiveCompare with shadow buffer
If nearer light, if further shadow
![Page 21: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/21.jpg)
Shadow Maps
21
Shadow Buffer Image w/ ShadowsFrom Stamminger and Drettakis SIGGRAPH 2002 Note: These images don’t really go together, see the paper...
![Page 22: CS-184: Computer Graphics › ~adamb › 435 › Slides › texture.pdf · CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James O’Brien University of California,](https://reader034.vdocuments.mx/reader034/viewer/2022042404/5f1aad96547e37682e0ef7b3/html5/thumbnails/22.jpg)
Deep Shadow Maps
Some objects only partially occlude lightA single shadow value will not work
Similar to transparency in Z-Buffer
22
FromLokovic and VeachSIGGRAPH 2000