TEXTURE MAPPING 1 OUTLINE Introduce Mapping Methods Texture - - PowerPoint PPT Presentation

texture mapping
SMART_READER_LITE
LIVE PREVIEW

TEXTURE MAPPING 1 OUTLINE Introduce Mapping Methods Texture - - PowerPoint PPT Presentation

TEXTURE MAPPING 1 OUTLINE Introduce Mapping Methods Texture Mapping Environment Mapping Bump Mapping Basic mapping strategies Forward vs backward mapping Point sampling vs area averaging Introduce


slide-1
SLIDE 1

1

TEXTURE MAPPING

slide-2
SLIDE 2

OUTLINE

  • Introduce Mapping Methods
  • Texture Mapping
  • Environment Mapping
  • Bump Mapping
  • Basic mapping strategies
  • Forward vs backward mapping
  • Point sampling vs area averaging
  • Introduce texture mapping
  • Two-dimensional texture maps
  • Assigning texture coordinates

2

slide-3
SLIDE 3

3

THE LIMITS OF GEOMETRIC MODELING

  • Although graphics cards can render over 10 million polygons per second, that number is

insufficient for many phenomena

  • Clouds
  • Grass
  • Terrain
  • Skin
slide-4
SLIDE 4

4

MODELING AN ORANGE

  • Consider the problem of modeling an orange (the fruit)
  • Start with an orange-colored sphere
  • Too simple
  • Replace sphere with a more complex shape
  • Does not capture surface characteristics (small dimples)
  • Takes too many polygons to model all the dimples
slide-5
SLIDE 5

5

MODELING AN ORANGE (2)

  • Take a picture of a real orange, scan it, and “paste” onto simple geometric model
  • This process is known as texture mapping
  • Still might not be sufficient because resulting surface will be smooth
  • Need to change local shape
  • Bump mapping
slide-6
SLIDE 6

6

THREE TYPES OF MAPPING

  • Texture Mapping
  • Uses images to fill interior points of polygons
  • Environment (reflection mapping)
  • Uses a picture of the environment for texture maps
  • Allows simulation of highly specular surfaces
  • Bump mapping
  • Emulates altering normal vectors during the rendering process
  • We will talk about environment and bump mapping later – after lighting – but

some image examples follow…

slide-7
SLIDE 7

7

TEXTURE MAPPING

geometric model texture mapped

slide-8
SLIDE 8

8

ENVIRONMENT MAPPING

slide-9
SLIDE 9

9

BUMP MAPPING

slide-10
SLIDE 10

10

IS IT SIMPLE?

  • Although the idea is simple---map an image to a surface---there are 3 or 4

coordinate systems involved

2D image 3D surface

slide-11
SLIDE 11

11

COORDINATE SYSTEMS

  • Parametric coordinates
  • May be used to model curves and surfaces
  • We haven’t talked about this yet – we will
  • Texture coordinates
  • Used to identify points in the image to be mapped
  • Object or World Coordinates
  • Conceptually, where the mapping takes place
  • Window Coordinates
  • Where the final image is really produced
slide-12
SLIDE 12

12

TEXTURE MAPPING

parametric coordinates texture coordinates world coordinates window coordinates

slide-13
SLIDE 13

13

BASIC STRAGEGY

Three steps to applying a texture 1. specify the texture

  • read or generate image
  • assign to texture
  • enable texturing

2. assign texture coordinates to vertices

  • Proper mapping function is left to application

3. specify texture parameters

  • wrapping, filtering
slide-14
SLIDE 14

14

TEXTURE MAPPING

s t x y z image geometry display

slide-15
SLIDE 15

TEXTURE MAPPING GONE WRONG

slide-16
SLIDE 16

TEXTURE MAPPING

slide-17
SLIDE 17

TEXTURE MAPPING DONE WELL

slide-18
SLIDE 18

18

  • Define a texture image from an array of

texels (texture elements) in CPU memory

  • Use an image in a standard format such as JPEG
  • Scanned image
  • Generate by application code

SPECIFYING A TEXTURE IMAGE

slide-19
SLIDE 19

19

  • Based on parametric texture coordinates
  • Specify as a 2D vertex attribute

s t

1, 1 0, 1 0, 0 1, 0 (s, t) = (0.2, 0.8) (0.4, 0.2) (0.8, 0.4) A B C a b c Texture Space Object Space

MAPPING A TEXTURE

slide-20
SLIDE 20

20

INTERPOLATION

OpenGL uses interpolation to find proper texels from specified texture coordinates Can be distortions

good selection

  • f tex coordinates

poor selection

  • f tex coordinates

texture stretched

  • ver trapezoid

showing effects

  • f bilinear

interpolation

slide-21
SLIDE 21

21

TEXTURE PARAMETERS

  • Variety of parameters that determine how texture is applied
  • Wrapping parameters determine what happens if s and t are outside the

(0,1) range

  • Filter modes allow us to use area averaging instead of point samples
  • Mipmapping allows us to use textures at multiple resolutions
  • Environment parameters determine how texture mapping interacts with

shading

slide-22
SLIDE 22

22

WRAPPING MODE

Clamping: if s,t > 1 use 1, if s,t <0 use 0 Wrapping: use s,t modulo 1

texture s t gl.CLAMP wrapping gl.REPEAT wrapping

slide-23
SLIDE 23

MIRRORED REPEAT, CLAMP TO EDGE, AND CLAMP TO BORDER

slide-24
SLIDE 24

24

MAGNIFICATION AND MINIFICATION

Texture Polygon Magnification Minification Polygon Texture

More than one texel can cover a pixel (minification) or more than one pixel can cover a texel (magnification) Can use point sampling (nearest texel) or linear filtering ( 2 x 2 filter) to obtain texture values

slide-25
SLIDE 25

SUMMARY

  • Introduce Mapping Methods
  • Texture Mapping
  • Environment Mapping
  • Bump Mapping
  • Basic mapping strategies
  • Forward vs backward mapping
  • Point sampling vs area averaging
  • Introduce texture mapping
  • Two-dimensional texture maps
  • Assigning texture coordinates

25