Docsity

Texture Mapping and Programmable Graphics Hardware: A Deep Dive, Slides of Computer Graphics

Partial preview of the text

Download Texture Mapping and Programmable Graphics Hardware: A Deep Dive and more Slides Computer Graphics in PDF only on Docsity!

Texture Mapping and

Programmable Graphics Hardware

Today

• More mapping

• Finish up Texture Mapping

• Bump Maps

• Displacement Maps

• Discussion of programmable graphics hardware

• Discussion of class project

BSP Tree Illustration

  • Let’s see an example (in 2D, not 3D)
    • Here, a line divides the plane into two half-

planes

Space BSP Tree

A

A

X

B C

C

X

B

Y

D

E E

Y

D

BSP Tree Review

  • Use implicit planes to carve up space (and

the geometry in it) into distinct subspaces

  • One BSP tree can be used for any

viewpoint

  • Can be used to implement a painter’s

algorithm

  • Or to speed up a raytracer...
    • We’ll be seeing this again
  • Any questions?

Sampling Issues

  • So we can define the mapping, and it

works fine

  • As long as the size of the rendered image is

approximately the same size as the texture

source

  • What if the textured polygon renders

much smaller in the final image

than the original texture?

  • How about much bigger?

Mip-mapping to the Rescue

  • Mip-mapping is a technique that creates

multiple resolutions of an image

  • i.e. Takes a 512x512 image and filters it to

create 256x256, 128x128, 64x64, ..., 1x

versions of it

  • Then, when you’re looking up your

texture coordinates, it uses the most

appropriate mip-map level

  • Or, more likely, interpolates between the two

closest

Assigning Texture Coordinates

  • We generally want an even sharing of

texels (pixels in the texture) across all

triangles

  • But what about this case?
    • Want to texture the teapot:

Do we want this? Or this? Docsity.com

Planar Mapping

  • Just use the texture to fill all of space
    • Same color for all z-values
    • (u, v) = (x, y)

Spherical Mapping

  • “Wrap” the texture around your object
    • Like a globe
    • Same color for all pixels with the same

angle

  • u = ϕ / 2π v = (π - θ) / π

Cube Mapping

  • Not quite the same as the others
    • Uses multiple textures (6, to be specific)
  • Maps each texture to one face of a cube

surrounding the object to be textured

  • Then applies a planar mapping to each face

Environment Mapping Example

Solid Textures

  • We’ve talked a lot about 2D (image) textures
    • Essentially taking a picture and pasting it on a

surface

  • No reason a texture HAS to be 2D, though
    • Can have 1D textures (not that interesting)
    • Can have 3D textures

Texture Mapping Review

  • Texture mapping is a relatively simple way

to add a lot of visual complexity to a

scene

  • Without increasing its geometric complexity
  • Use mip-mapping to alleviate sampling

problems

  • There are infinitely many possible

mappings

  • Usually want to use the most “similar” one
    • Texturing a plane? Use planar
    • Texturing a sphere? Use spherical Docsity.com

Other Mapping Techniques

  • So, now we know some things about

texture mapping

  • Allows us to change the color of simple

geometry

  • But color isn’t the only property a

point can have

  • Normals
    • Bump mapping
  • Location
    • Displacement Mapping