CMSC 635: Advanced Computer Graphics

Texture Mapping

Spring 1999

David S. Ebert
Computer Science and Electrical Engineering Department
University of Maryland, Baltimore County



Texture Mapping




Map in object space



In texture space for quadrilaterals




Correction:

P0v = P00 + v (P01 - P00)

P1v = P10 + v (P11 - P10)

Puv = P0v + u (P1v - P0v)

Puv = {P00 + v (P01 - P00)} + u{ (P10 + v (P11 - P01)) - (P00 + v (P10 - P00))}

...

solve for u and v.

In general case, add Pij's u,v coordinates into equation.

Before do this,

Now what do you do ?


Solution: Antialiased texture mapping


Object Space vs. World Space for Mapping

  • In world space, object will move through the texture. -- The texture is not stuck to the object.

  • Example:


Other Mapping Functions

  • Spherical Mapping Example
  • Cylindrical Mapping Examples
  • Box Mapping Examples


Bump Mapping [Blinn 78]

  • Texture map contains displacement to the surface.


Mathematical Derivation:

Decompose N into partial surface derivatives in the u and v directions: Pu Pv.

N = Pu X Pv

F(u,v) is displacement of surface,

P' = P + F(u,v) * N /||N||

Assuming F is negligibly small,


N' = P'u X P'v

P'u = Pu + Fu * N /||N||

P'v = Pv + Fv * N /||N||

N' = N + D

D = [Fu(N X Pv) - Fv(N X Pu)] / ||N||

How do we calculate Fu, Fv?

Given F(u,v) function, ep = 1 / (TextureMapResolution)


Fu = (F(u+ep, v) - F(u - ep, v)) / (2*ep)

Fv = (F(u, v+ep) - F(u, v - ep)) / (2*ep)

How do we calculate Pu, Pv?

  • Displace world space point in +u, -u direction and +v, -v direction by small amount and calculate approximated partial derivative as :
    Pu = (P(p+uepsilon) - P(p-uepsilon)) / (2 * epsilon)
    Pv = (P(p+vepsilon) - P(p-vepsilon)) / (2 * epsilon)

  • If smooth shading, need to adjust this because of interpolated normals:
    PVtemp = Pu X N
    Pu = N X PVtemp

    PUtemp = Pv X N
    Pv = N X PUtemp


Dependence on scale:

If scale object, need to adjust displacement map accordingly


D' = alpha * D * |N|/|D| ,

alpha = sqrt ( Fu2 + Fv2)

N'' = N + D'


Displacement Mapping [Cook 84]

  • Use texture map to displace actual surface geometry. (vertices, control vertices)

  • Done as a pre-process to geometry before the actual rendering

  • Requires fine resolution in geometry or will get unexpected holes.

  • Alternative is for program to add geometry when displacement variation can't smoothly be represented in geometry.

  • Example of Bump Mapping vs. Displacement Mapping

  • How do you tell the difference between the two?


Environment Mapping (Reflection Mapping) [Newell 76]

  • Used to simulate ray traced reflections.

  • Use reflection vector as index into texture map.

  • Texture map is either hand drawn or precomputed rendering of scene viewed from that location (often times 6 directional rendering ).

  • Normally use box projection or spherical.

  • Examples of box projection:

  • Notice the differences in the ray traced vs. environmental mapped images:

  • Key to tell which is which? Look for object reflecting itself.


Return to CMSC 635 Notes Page


Last modified: Fri Mar 26 10:56:17 EST 1999