CS-184: Computer Graphics Lecture #11: Texture and Other Maps - - PowerPoint PPT Presentation

cs 184 computer graphics
SMART_READER_LITE
LIVE PREVIEW

CS-184: Computer Graphics Lecture #11: Texture and Other Maps - - PowerPoint PPT Presentation

1 CS-184: Computer Graphics Lecture #11: Texture and Other Maps Prof. James OBrien University of California, Berkeley V2015-S-11-1.0 2 Today Texture Mapping 2D 3D Procedural Bump and Displacement Maps Environment


slide-1
SLIDE 1

CS-184: Computer Graphics

Lecture #11: Texture and Other Maps

  • Prof. James O’Brien

University of California, Berkeley

V2015-S-11-1.0

1

2

Today

  • Texture Mapping
  • 2D
  • 3D
  • Procedural
  • Bump and Displacement Maps
  • Environment Maps
  • Shadow Maps

2

slide-2
SLIDE 2

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

3

2D Texture Mapping of Images

  • Use a 2D image and map it to the surface of an object

4

Color Specular Bump

4

slide-3
SLIDE 3

2D Texture Mapping of Images

5

5

2D Texture Mapping of Images

6

6

slide-4
SLIDE 4

2D Texture Mapping of Images

7

7

2D Texture Mapping of Images

8

8

slide-5
SLIDE 5

2D Texture Mapping of Images

  • Example of texture distortion

9

9

Texture Coordinates

  • Assign coordinates to each vertex
  • Within each triangle use linear

interpolation

  • Correct for distortion!

10

s t

10

slide-6
SLIDE 6

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

11

11

Procedural Textures

  • Generate texture based on some function
  • Well suited for “random” textures
  • Often modulate some noise function

12 [Foley et al. / Perlin]

12

slide-7
SLIDE 7

Assigning Texture Coordinates

  • Map a simple shape onto object by projection
  • Sphere, cylinder, plane, cube
  • Assign by hand
  • Use some optimization procedure

13

13

Repeating Textures

  • Image Tiles allow repeating textures
  • Images must be manipulated to allow tilling
  • Often result in visible artifacts
  • There are methods to get around artifacts....

14

14

slide-8
SLIDE 8

Repeating Textures

  • Image Tiles allow repeating textures
  • Images must be manipulated to allow tilling
  • Often result in visible artifacts
  • Artifacts not an issue for artificial textures

15

15

Non-Color Textures

16

Color Specular Bump

16

slide-9
SLIDE 9

Bump Mapping

17

No bump mapping With bump mapping

Images by Paul Baker www.paulsprojects.net

17

Bump Mapping

  • Add offset to normal
  • Offset 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

18

b(u,v) = [s,t,n](u,v) = ∇i(u,v)

∇ =  ∂ ∂u, ∂ ∂v T

18

slide-10
SLIDE 10

Bump Map Example

19

Catherine Bendebury and Jonathan Michaels CS 184 Spring 2005

19

Displacement Maps

  • Actually move geometry based on texture map
  • Expensive and difficult to implement in many rendering systems
  • Note silhouette

20

Bump Displacement

20

slide-11
SLIDE 11

Normals Maps

21

[Paolo Cignoni]

21

Texture Coordinate Assignment

22 [Wolfe / SG97 Slide set]

22

slide-12
SLIDE 12

Texture Coordinate Assignment

23

  • Planar projection

u v

Marschner, 2014

23

Texture Coordinate Assignment

24

  • Spherical Coordinates

Marschner, 2014

24

slide-13
SLIDE 13

Texture Coordinate Assignment

25

  • Spherical Projection

Marschner, 2014

25

Texture Coordinate Assignment

26

  • Cylindrical Projection

Marschner, 2014

spherical cylindrical

26

slide-14
SLIDE 14

Texture Coordinate Assignment

27

  • Multiple Projections

[Tito Pagan]

27

Texture Coordinate Assignment

28

  • 3D Textures

[Wolfe / SG97 Slide set]

28

slide-15
SLIDE 15

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

29

29

Environment Maps

30

30

slide-16
SLIDE 16

Environment Maps

31 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+x 2x v = z+x 2x

31

Environment Maps

  • Sphere based parameterization
  • Wide angle image or
  • Photo of a silver ball

32

Images by Paul Haeberli

32

slide-17
SLIDE 17

Environment Maps

33

(a) (b)

Figure 2. (a). A shiny sphere rendered under photographically acquired real-world illumination. (b). The same sphere rendered under illumination by a point light source.

[Dror, Willsky, & Adelson 2004]

33

Environment Maps

34

Note errors

  • Used in 1985 in movie Interface
  • Effect by group from the New

York Institute of Technology

34

slide-18
SLIDE 18

Environment Maps

  • Used in 1985 in movie Interface
  • Effect by group from the New

York Institute of Technology

35

35

Shadow Maps

36

  • Pre-render scene from perspective of light source
  • Only render Z-Buffer (the shadow buffer)
  • Render scene from camera perspective
  • Compare with shadow buffer
  • If nearer light, if further shadow

36

slide-19
SLIDE 19

Shadow Maps

37

Shadow Buffer Image w/ Shadows

From Stamminger and Drettakis SIGGRAPH 2002

Note: These images don’t really go together, see the paper...

37

Deep Shadow Maps

  • Some objects only partially occlude light
  • A single shadow value will not work
  • Similar to transparency in Z-Buffer

38

From Lokovic and Veach SIGGRAPH 2000

38