CSE 681 Texture Mapping: An OverviewReview - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

CSE 681 Texture Mapping: An OverviewReview

Description:

Map onto untransformed surfaces ... Map the intersection point of the visible surface to object space. Map to texture space ... Map the texture onto a simple ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 22
Provided by: naeems
Category:

less

Transcript and Presenter's Notes

Title: CSE 681 Texture Mapping: An OverviewReview


1
CSE 681Texture Mapping An Overview/Review
2
Why Textures?
  • How can we model this scene with polygons?
  • Lots of detail means lots of polygons to render
  • 100s, 1000s, Millions of polygons!
  • Modelling is very difficult and cumbersome

3
Why Textures?
  • Render a single polygon with a picture of a brick
    wall mapped to it?

4
The Quest for Visual Realism
5
Textures
  • Phong lighting just wont do
  • Plastic, rubber, or metallic looking objects
  • Add surface detail with real world patterns and
    images
  • We get modelled detail at a low cost
  • Very useful in games a billion dollar industry
  • Provides realism at a low cost
  • Graphics hardware vendors work hard to optimize
    texture mapping

6
Terminology
  • Texture An array of values
  • 2D (most common), 1D, and 3D
  • Color, alpha, depth, and even normals
  • Texel A single array element
  • Texture Mapping The process of relating texture
    to geometry

7
Texture Sources
  • Pixel maps (bitmaps)
  • Load from an image file gif, jpg, tiff, ppm,
    etc.
  • Procedural textures
  • Program generated texel values

8
Procedural Textures
  • Checkerboard texture with 8 x 8 texels for each
    box

RGB checkerboard(int rows, int cols) pixel
new RGB(3 rows cols) long index 0 for
(int i 0 i lt rows i) for (int j 0
j lt cols j) texelindex.red 1.
texelindex.green 1.
texelindex.blue 1.
index 0 for (i 0 i lt rows i) for
(j 0 j lt cols j) if (((i/8)
(j/8))2) 0) texelindex.green 0.
texelindex.blue 0.
9
Texture Mapping
  • How do we apply a texture onto an object?
  • Construct a mapping between the texture and
    object
  • Use the texture to lookup surface attributes

10
Texture Mapping
  • Problems
  • The texture and object are in two different
    spaces
  • Where in the rendering pipeline do we specify
    this mapping?
  • Object or world space?
  • Map onto untransformed surfaces
  • Texture filtering A point on the surface maps to
    a location between texels in the texture

11
Texture Space
  • A texture is defined in a normalized space
  • 2D textures (s, t) ? 0 1, 0 1
  • Some times (u, v) is used also

12
Texture Value Lookup/Filtering
  • Normalized space is continuous but the texture is
    a discrete array
  • Texel values are located on a cartesian grid

(1,1)
Index (s, t) may not land on a grid value
(0.25,0)
(0.5,0)
(0.75,0)
(0,0)
(1,0)
13
Raytracing a Textured Object
  • Shoot ray
  • Map the intersection point of the visible surface
    to object space
  • Map to texture space
  • Filter the texture
  • Determine pixel color with retrieved texture
    information

Eye or World
World to Object
Object to Texture
14
Map 2D Textures To Objects
  • Define mapping between object and texture spaces
  • For example, a simple quad in object space is
    easy!
  • Akin to wall papering or gift wrapping

15
Mapping 2D Textures To Objects
16
2D Texture Mapping Approaches
  • Intermediate Mapping
  • Map the texture onto a simple intermediate
    surface
  • Map the intermediate surface to the final object
  • Intermediate objects
  • Plane
  • Sphere
  • Cylinder
  • Cube

17
Planar Mapping
Project to an axial plane, e.g. drop z coord
(s,t) (x, y)
18
Spherical Mapping
Mapping Polar (u, v) coordinates
19
Cylindrical Mapping

Mapping Cylindrical (u, v) coordinates
20
Cube Mapping
21
Intermediate Mapping
Paul Bourke
Write a Comment
User Comments (0)
About PowerShow.com