Texture Mapping - PowerPoint PPT Presentation

1 / 82
About This Presentation
Title:

Texture Mapping

Description:

... unwanted side effect of keeping the texture constant in one direction. ... Using a different set of textures: Box Map. We get: Texture Mapping Applet. Map Entity ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 83
Provided by: cs6
Category:
Tags: mapping | setup | texture

less

Transcript and Presenter's Notes

Title: Texture Mapping


1
Texture Mapping
  • (Some Images from Rosalee Wolff)

2
Texture Mapping
  • Problem with shading models
  • -they assume that a diffuse surface has uniform
    reflectance
  • This is okay for walls or pool balls, but not
    most objects
  • We could add geometric complexity
  • - BAD! Too time consuming
  • Alternative Texture mapping
  • - Developed by Catmull (1974), Blinn and Newell
    (1976), and others

3
Texture Mapping
  • Goal add visual detail without adding geometric
    detail
  • 8 polygons 8 polygons

4
Typical Textures
5
Replicating Textures
6
Replicating Textures
7
Textures
Any image can be used as a texture map
8
Texture Mapping
  • There are both 2D and 3D versions of texture
    mapping
  • 2D wallpaper a 2D image onto an object
  • 3D carve a 3D object out of a block

9
2D Texture Mapping
  • Given a 2D texture (image) and a 3D object, map
    the texture onto the object.
  • Where does each point on the object map into the
    texture?

10
Texture Map Shapes
  • Planar Map
  • Simply remove one of the objects coordinates
    (project onto that coordinate plane)

11
Planar Map
  • This has the unwanted side effect of keeping the
    texture constant in one direction.
  • E.g., projecting along Z

12
Planar Map
  • Projecting along X and Y respectively

13
Cylindrical Map
  • Instead of a planar map, we could use a
    cylindrical map
  • (x,y,z) is converted to (r, theta, height).
  • For texture mapping, theta is converted into a
    u-coordinate and height is converted into a
    v-coordinate.
  • This wraps the two-
  • dimensional texture
  • map around the object.

14
Cylindrical Map
  • At minimum and maximum extents of the cylinder,
    the texture gets pinched together.
  • E.g., a cylindrical map parallel to Z

15
Cylindrical Map
  • Similarly if the map is parallel to X or Y

16
Spherical Map
  • Convert from (x, y, z) to spherical coordinates.
  • Latitude is converted to a u-coordinate,
    longitude is converted to a v-coordinate.

17
Spherical Map
  • This still has the effect of pinching the texture
    at the poles, but differently than using a
    cylindrical map.

18
Spherical Map
  • With the poles in the X and Y directions

19
Box Map
  • We can use a collection of planar maps to provide
    better coverage than using a single planar map

20
Box Map
  • We project each plane onto its portion of the
    object.
  • Use the objects normal to determine which
    texture to use.

21
Box Map
  • This produces

22
Box Map
  • Using a different set of textures

23
Box Map
  • We get

24
Texture Mapping Applet
25
Map Entity
  • To texture map, we take an (x, y, z) value from
    the object and determine a (u, v) texture value.
  • How we determine what we use as the (x, y, z)
    value is the map entity.
  • Can use various things
  • a point on the object relative to the objects
    bounding box
  • the surface normal at the point being rendered
  • a vector running from the objects centroid
    through the point
  • the reflection vector at the current point

26
Map Entity
27
Map Entity
  • Using the same map shape, but different map
    entity can give quite different results.
  • Planar Mapping

28
Map Entity
  • Cylindrical Mapping

29
Map Entity
  • Spherical Mapping

30
Map Entity
  • Box Mapping

31
Texture Mapped Scene
http//daemonic.xeebra.com/raytracer/texture_mappi
ng.png
32
Another Example
33
The Texture Mapping Process
(inverse map)
(raytrace)
Pixel
Texture Map
Surface
34
  • Consider surface visible at current pixel.
  • Find the patch on the surface that corresponds to
    it.
  • Map screen coord of pixel corners back to object
  • Find texels that map to the surface patch
  • If multiple texels lie on patch combine them
  • weighted avg supersampling with
    postfiltering

35
Mapping Parametric Surfaces
  • Parametric surfaces are already parameterized by
    (s, t).
  • Use the (s,t) parameters as the (u,v) texture
    parameters

36
The Utah Teapot
  • 32 Parametric patches

37
Non-Parametric Surfaces
  • If we assign values to the vertices in the range
    (0,1), we can use the same texture mapping
    approach

38
Non-linear Mapping
  • We can distort the texture by using a non-linear
    mapping

39
Triangles
  • Given a triangle defined by three points (a, b,
    c), how do we associate a texture color with a
    point on the triangle?

c
?
b
a
40
Computing the Point
  • Given the (x,y) point in the triangle, how do we
    transform that to a (u,v) point in the image?
  • Set up a non-orthogonal coordinate system with
    origin a and basis vectors (b-a) and (c-a)

c
g2
c-a
g1
b
b-a
a
g0
b-1
b0
b1
41
Barycentric coordinates
  • Any point on the triangle can be defined by the
    barycentric coordinate
  • p a b(b-a) g(c-a)

c
g2
p
c-a
g1
b
b-a
a
g0
b-1
b0
b1
42
Barycentric coordinates
  • Once we have computed the (b,g) barycentric
    coordinate for the triangle, we can determine the
    corresponding (u, v) point.
  • First, establish the (u, v) system

(0, 1)
(1, 1)
(0, 0)
(1, 0)
43
Computing the (u, v) coordinate
  • u(b, g) ua b(ub ua) g(uc ua)
  • v(b, g) va b(vb va) g(vc va)

44
Performing the transformation
  • We can then compute the color for that point of
    the triangle.

c
b
a
45
Other Mapping Applications
  • Color Mapping diffuse component of surface
    (standard texture mapping)
  • Reflection Mapping specular component of surface
    to simulate reflection (environment mapping)
  • Normal vector Mapping simulate 3D surface
    structure (bump mapping)
  • Geometry Mapping raise/lower points to actually
    modify surface (displacement mapping)
  • Transparency Mapping vary the transparency
    across the object

46
Reflection Mapping
  • Also called Environment Mapping
  • Idea
  • surround the scene with an image
  • for reflective surfaces, rather than ray tracing
    them, simply see what part of the image would be
    seen on the object
  • Used in Abyss, Terminator 2

47
Reflection Mapping Example
From Ed Angel, Interactive Computer Graphics,
Addison-Wesley 2002
48
Reflecting
N
V
R
49
Reflection Mapping
  • Usually done either with
  • Sphere (or hemisphere)
  • Cube

50
Hemisphere Mapping
N
V
R
51
Hemisphere Mapping
  • Objects mapped onto the hemisphere will look the
    same as the objects out in space
  • The hemisphere map is used as the texture map

52
Cube Mapping
  • Same idea as hemisphere mapping, but use a cube
    instead
  • Simpler in some ways
  • Have to deal with the corners and edges of the
    cube

53
Hemisphere Mapping
N
V
R
54
Issues with Reflection Mapping
  • Must assume that the environment is very far away
    from the scene
  • No self reflections (concave objects dont work
    correctly)
  • No reflections between objects

55
Example
from http//www.inf.ufrgs.br/7Eoliveira/Cursos/C
MP513/CMP513_trabalhos.html
56
Bump Mapping
  • Texture mapping adds color detail to the object,
    but the object still looks smooth
  • How do you make the object look rough?
  • Solution 1 Could add more polygons
  • Too time intensive
  • Solution 2 Bump mapping

57
Bump Mapping
  • Idea
  • If we use fake normals, we can trick the
    renderer into thinking there are bumps on the
    surface

Flat Plane
Real Bump
Fake Bump
58
Sphere with Texture and Bump Maps
Bump Map
Sphere with Texture Map
59
The Bump Map
  • The bump map is defined as an array of
    displacements B(u,v)
  • If P(u,v) specifies positions on a parametric
    surface, the normal at the surface can be
    calculated as
  • where and are partial derivatives
    of the surface at point P lying in the tangent
    plane

N
Pu
Pv
60
Bump Mapping
  • We can simulate bumps by adding small
    perturbations to the surface positions along the
    direction of the normal

61
Bump Mapping
  • So far we have

Original surface P
Bump map B
Bump map applied to surface giving P
62
Bump Mapping
  • Next we compute new normals for bump mapped
    surface

63
  • What are the partials?

64
  • To simplify, we approximate, using as the reason
    that the bump should be significantly smaller
    than the surface. Thus, we remove the last terms
    of the equations, giving

65
  • Now, since

66
  • And, since

then
67
  • This gives
  • This gives a normal perturbation that is
  • independent of the position of the object
  • independent of the orientation of the object
  • i.e., a position on the object will always get
    the same perturbation

68
Bump Function
  • Bump function can be
  • Analytical expression
  • Table lookup
  • use linear interpolation to compute B
  • use finite differences to approximate Bu and Bv

69
Bump Mapping Examples
70
Bump Mapping Examples
71
Bump Mapping Examples
72
Bump Mapping Examples
  • from http//www.vis-sim.org/support/vp_websamples2
    .shtml

73
Horizon Mapping
  • A technique to try to get shadow information from
    a bump-mapped surface
  • For each point on the surface, the angle to the
    horizon is computed and stored in a horizon map
  • Stored for a small number of directions (8 or 16
    usually)
  • To compute lighting, the horizon map is
    consulted, the height of the point being rendered
    is determined, and the angle to the light is
    computed
  • If the light angle is less than the horizon map
    angle, the point is in shadow

74
Horizon Mapping
  • from http//www.soft.dk/directx-3d-demos.htm

75
Displacement Mapping
  • The actual geometry is altered in order to allow
    for a more bumpy look
  • A displacement map is given, along with the
    surface
  • The displacement map is applied to the surface,
    and additional geometry is introduced where
    needed
  • Gives a more realistic look, particularly at the
    silhouette
  • Quite a bit more costly than the other techniques

76
(No Transcript)
77
Parallax Mapping
  • Also termed view displacement mapping
  • Texture coordinates are displaced as a function
    of the view angle and the height at the point
    being rendered
  • Gives similar effects as displacement mapping,
    without the overhead of increased geometry

78
Parallax Mapping
  • Example of parallax mapping. The walls are
    textures with parallax maps. Screenshot taken
    from one of the base examples of the opensource
    Irrlicht 3d engine.

79
Parallax Mapping
80
Comparison
Displacement mapping
Bump mapping
81
Comparison
  • from http//www.chromesphere.com/Tutorials/Vue6/Op
    tics_Basics_Print.html

82
Comparison
Bump Mapping
Horizon Mapping
Displacement Mapping
View Dependent Displacement Mapping
Write a Comment
User Comments (0)
About PowerShow.com