Docsity

Texture Mapping - Computer Graphics - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Texture Mapping - Computer Graphics - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

MIT EECS 6.837, Durand and Cutler

Texture Mapping & Other

Fun Stuff

The Problem: • Don't want to represent all this detail with

geometry

Today • 2D Texture Mapping

  • Perspective Correct Interpolation – Illumination – Texture Mapping Difficulties – Projective Texturing
    • Other Mapping Techniques

Photo-textures

Texture Coordinates • Specify a texture coordinate (u,v) at each vertex • Canonical texture coordinates (0,0)

  • Often the texture size is a power of 2

(but it doesn't have to be)

  • How can we tile

this texture?

(0,0)

(1,0)

(0,1)

Docsity.com

Tiling Texture

(0,3)

(0,3)

seamless tiling

(repeating)

tiles with visible seams

(0,0)

(3,0)

(0,0)

(3,0)

Docsity.com

What Goes Wrong?

texture source

what we get

what we want

Looking at One Edge • Consider one edge from a

given triangle. This edge andits projection onto our viewportlie in a single common planeillustrated below:

Courtesy of

Leonard McMillan, Computer Science

at the University of North Carolina in Chapel Hill

.

Used with permission.

How do we fix it? • We can reduce the perceived artifacts of non-

perspective correct interpolation by subdividingthe model into smaller triangles. Why?

  • However, sometimes the

errors become obvious^ – At "T" joints^ – When switching between

levels-of-detail representations (mipmapping... next time)

Subdivision

Linear Interpolation in Screen Space

Compare linear interpolation in screen space to interpolation in 3-space

Perspective Correct Interpolation We need a mapping from

t^

values to

s

values:

Solve for

s

in terms of

t :

Unfortunately, at this point in the pipeline (after projection) we nolonger have

z

.^

However, we do have

w

1/z

1

and

w

2

=^

1/z

, so: 2

Today • 2D Texture Mapping

  • Perspective Correct Interpolation – Illumination – Texture Mapping Difficulties – Projective Texturing
    • Other Mapping Techniques

Texture Mapping & Illumination •^

Texture mapping can be used to alter some or all of theconstants in the illumination equation: as the final color for thepixel, or as the diffuse color, or to alter the normal, ... thepossibilities are endless! (e.g. GL_DECAL, GL_MODULATE,GL_BLEND, ...)

Phong's Illumination Model

Constant Diffuse Color

Diffuse Texture Color

Texture used as Label

Texture used as Diffuse Color