14-texture

8
1 Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2004 Texture Mapping Surface Image Texture Textures Descri be color va riation in i nterio r of 3D polyg on When scan converting a polygon, vary pixel colors according to values fetched from a texture Angel Figure 9.3 “Texels” “Pixels” 3D Rendering Pipeline (for direct illumination) 3D Primitives Modeling Transformation Projection Transformation Clipping Lighting Image Viewport Transformation Scan Conversion 2D Image Coordinates 3D Modeling Coordinates 3D World Coordinates 3D Camera Coordinates 2D Screen Coordinates 2D Screen Coordinates Viewing Transformation 3D World Coordinates 2D Image Coordinates Texture mapping Surface Textures Add visu al deta il to surf aces of 3 D objec ts Polygonal model With surface texture Surface Textures Add visu al deta il to surf aces of 3 D objec ts [Daren Horley] Parameterization geometry geometry + = image image texture map texture map Q: How do we decide where on the geometry each color from the image should go?

Transcript of 14-texture

Page 1: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 1/8

1

Greg Humphreys

CS445: Intro Graphics

University of Virginia, Fall 2004

Texture Mapping

Surface

ImageTexture

Textures

• Describe color variation in interior of 3D polygon When scan converting a polygon, vary pixel colors

according to values fetched from a texture

Angel Figure 9.3

“Texels”“Pixels”

3D Rendering Pipeline (for direct illumination)

3D Primitives

ModelingTransformation

ProjectionTransformation

Clipping

Lighting

Image

ViewportTransformation

Scan

Conversion

2D Image Coordinates

3D Modeling Coordinates

3D World Coordinates

3D Camera Coordinates

2D Screen Coordinates

2D Screen Coordinates

ViewingTransformation

3D World Coordinates

2D Image Coordinates

Texture mapping

Surface Textures

• Add visual detail to surfaces of 3D objects

Polygonal model

With surface texture

Surface Textures

• Add visual detail to surfaces of 3D objects

[Daren Horley]

Parameterization

geometrygeometry

++ ==

imageimage texture maptexture map

• Q: How do we decide where on the geometry

each color from the image should go?

Page 2: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 2/8

2

Option: Varieties of projections

[Paul Bourke][Paul Bourke]

Option: unfold the surface

[Piponi2000]

Option: make an atlas

[Sander2001]

charts atlas surface

Option: it’s the artist’s problem

Overview

• Texture mapping methods Parameterization

Mapping

Filtering

• Texture mapping applications Modulation textures

Illumination mapping Bump mapping

Environment mapping

Image-based rendering

Volume textures

Non-photorealistic rendering

Texture Mapping

• Steps: Define texture

Specify mapping from texture to surface

Lookup texture values during scan conversion

(0,0)

(1,0)

(0,1)

u

v

x

y

ModelingCoordinate

System

ImageCoordinate

System

s

t

TextureCoordinate

System

Page 3: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 3/8

3

Texture Mapping

• When scan convert, map from … image coordinate system (x,y) to

modeling coordinate system (u,v) to

texture image (t,s)

(0,0)

(1,0)

(1,1)

(0,1)

u

v

x

y

ModelingCoordinate

System

ImageCoordinate

System

s

t

TextureCoordinate

System

Texture Mapping

Allison Klein, Princeton

• Texture mapping is a 2D projective transformation texture coordinate system: (t,s) to

image coordinate system (x,y)

Naïve Texture Mapping

• A first cut at a texture-mapping rasterizer: For each pixel:

» Interpolate u & v down edges and across spans

» Look up nearest texel in texture map

» Color pixel according to texel color (possibly modulated

by lighting calculations)

McMillan’s demo of this is athttp://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide05.html

What artifacts do you see in this demo? 

Naïve Texturing Artifacts

• Warping at edges of triangles

• A more obvious example:

 http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide06.html

• Consider the geometry of interpolating parameters

more carefully

Interpolating Parameters

• The problem turns out to be fundamental to

interpolating parameters in screen-space Uniform steps in screen space ≠  uniform steps in world space

Texture Mapping

Linear interpolationof texture coordinates

Correct interpolationwith perspective divide

Hill Figure 8.42

Page 4: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 4/8

Page 5: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 5/8

Page 6: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 6/8

6

Texture Mapping Variations

• A texture can modulate any parameter in the Phong

lighting equation

Texture as

R,G,B:

Texture as

diffuse lighting 

coefficients:

Bump Mapping

• Texture = change in surface normal!

Sphere w/ di ffuse texture Swirly bump mapSphere w/ diffuse texture

and swirly bump map

+ =

More Bump Mapping

• How can you tell a bumped-mapped object from an

object in which the geometry is explicitly modeled? 

Displacement Mapping

Illumination Maps

• Quake introduced illumination maps or light maps to

capture lighting effects in video games

Texture map:

Texture map

+ light map:

Light map

Environment Maps

Images from Illumination and Reflection Maps:Simulated Objects in Simulated and Real Environments

Gene Miller and C. Robert HoffmanSIGGRAPH 1984 “Advanced Computer Graphics Animation” Course Notes

Page 7: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 7/8

7

Solid textures

Texture values indexed

by 3D location (x,y,z)• Expensive storage, or 

• Compute on the fly,

e.g. Perlin noise

Procedural Texture

Procedural Texture Gallery

Page 8: 14-texture

8/7/2019 14-texture

http://slidepdf.com/reader/full/14-texture 8/8

8