Computer Graphics - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Computer Graphics

Description:

Improved appearance of surface details enhances photo-realism ... pixel-order) scanning more popular than texture scanning ... image-order scanning is popular ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 24
Provided by: claudecch
Category:

less

Transcript and Presenter's Notes

Title: Computer Graphics


1
Computer Graphics
School of Computing Staffordshire University
Mapping Techniques
Dr. Claude C. Chibelushi
2
Outline
  • Introduction
  • Texture Mapping
  • Coordinate transformation
  • Distortions
  • Relief Mapping
  • Reflection Mapping
  • Summary

3
Introduction
  • Most objects have patterns on their surface
  • colour pattern, surface bumps, reflections, ...
  • e.g. brick wall, gravel, hair, wood, orange skin
  • Improved appearance of surface details enhances
    photo-realism
  • e.g. surface roughness, reflectivity, ...

4
Introduction
  • Costly or ineffective to produce intricate
    surface pattern by using
  • smooth shading (i.e. shades of single colour)
    colour details
  • high number of small polygons, or curves
    roughness details
  • ray tracing of reflective surfaces
    reflection details

5
Introduction
  • Mapping can produce realistic surface details for
    little geometric complexity
  • for colour details
  • copy picture of pattern onto surface
  • process known as texture mapping
  • for roughness details
  • apply pattern of bumps onto flat surface
  • process known as bump mapping
  • for reflection details
  • apply reflected pattern (of objects in
    environment) onto surface
  • process known as environment mapping
  • for other details lighting,

6
Introduction
Illustration of smooth shading, and texture
mapping
7
Texture Mapping
  • Texture mapping
  • Variety of techniques for adding surface details
  • enhanced realism but higher computational and
    storage cost
  • typically maps 2D texture onto 3D object (or vice
    versa)
  • assigns texel from texture to point on object
    surface
  • can be viewed as coordinate transformation /
    mapping

8
Texture Mapping
  • Texture pattern can be obtained from
  • camera real image (rectangular grid of pixels
  • popular approach, particularly for intricate or
    fine surface details
  • procedure that synthesises desired texture
  • e.g. pixel-value undulations (sinusoids coupled
    with some randomness) for producing wood-grain
    pattern

9
Texture Mapping
  • Texture stretched / shrunk like rubber to fit
    onto object
  • pattern typically mapped onto planar object faces
  • sometimes (e.g. when no texel-vertex
    correspondence is available -- see environment
    mapping) pattern
  • first warped onto (symmetrical) dummy with
    curved surfaces (e.g. cylinder, sphere)
  • then transferred from dummy onto target object

10
Texture Mapping
  • Mapping process
  • transformation of coordinates from texture space
    to object / image space
  • 2D texel array mapped onto 3D surface
  • but, how good is mapping of flat texture onto
    curved 3D surface?
  • also, desired object appearance may require 3D
    texture (e.g. for semi-transparent object)
  • 3D surface projected onto 2D view window

11
Texture Mapping
  • Coordinate transformation

12
Texture Mapping
  • Coordinate transformation
  • Image-order (or pixel-order) scanning more
    popular than texture scanning
  • avoids possible gaps in target image
  • some approaches require inversion of forward
    transformation matrix

13
Texture Mapping
  • Coordinate transformation

14
Texture Mapping
  • Coordinate transformation
  • Part of texture stretched or contracted to fit
    target polygon
  • based on specified location of vertices on
    texture
  • pre-calculated or manual attachment of texture to
    object vertices
  • implementation
  • rendering approaches
  • interpolation incremental computation of
    coordinates
  • homogeneous matrices for transformations of
    coordinates
  • data structures for polygonal model with texture
  • polygon vertex coordinates, texture coordinates,
    normal(s)

15
Texture Mapping
  • Coordinate transformation
  • Naïve (linear) interpolation method
  • only 2D coordinates are considered
  • options
  • discard depth
  • map texture onto projection of facet
  • easy implementation and low computational cost
  • may give poor results (see distortions)
  • lacks perspective foreshortening

16
Texture Mapping
  • Coordinate transformation
  • Naïve (linear) interpolation method

(x1, y1) -gt (s1, t1) (x2, y2) -gt (s2, t2) (x3,
y3) -gt (s3, t3)
  • Replace t by s to obtain second coordinate of
    pixel
  • Efficiency use incremental calculations

17
Texture Mapping
  • Coordinate transformation
  • Naïve (linear) interpolation method
  • use incremental computation
  • along polygon edge
  • tcurrent tprevious (t1 - t2) / (y1 - y2)
    (along edge between 1 and 2)
  • tcurrent tprevious (t1 - t3) / (y1 - y3)
    (along edge between 1 and 3)
  • along scan line
  • tcurrent tprevious (t5 - t4) / (x5 - x4)
    (along scan line from 4 to 5)

18
Texture Mapping
  • Coordinate transformation
  • Texture mapping which incorporates perspective
    effect
  • shrink texture map as corresponding z increases
  • modify naive interpolation equations by
    interpolating homogeneous coordinates (s, t, q)
  • s s / q, t t / q, q 1 / z
  • i.e linear interpolation between (s, t , q) and
    (x, y), but non linear interpolation between (s,
    t) and (x, y)

19
Texture Mapping
  • Coordinate transformation
  • Other texture mapping approach
  • rational linear transformation two mapping
    equations in form of ratios of polynomials
  • x as function of s and t and y as function of s
    and t
  • 8 unknown coefficients in total
  • solution requires association between 4 texels
    (texture space) and four vertices (screen space)
  • homogeneous matrices often used

20
Texture Mapping
  • Coordinate transformation
  • Rational linear transformation using homogeneous
    texture- and screen-space coordinates

i can be set 1 hence 8 unknowns determined using
4 (2D) points
21
Texture Mapping
  • Coordinate transformation
  • Rational linear transformation

22
Texture Mapping
  • Pixel lighting
  • Two options
  • texel directly used as colour of pixel
  • no illumination model applied
  • texel modulates reflection coefficients
  • hence varies amount of reflected light

23
Texture Mapping
  • Distortions
  • Shape and aliasing distortion due to
  • curvature of target surface
  • texture image generally flat but object surface
    may be curved
  • mapping rectangular texture onto two triangles
  • solutions bilinear interpolation onto quad use
    of perspective correction or reduction of
    polygon size
  • size differences between texture and target
    images
  • many-to-one (or one-to-many) mapping results in
    aliasing
  • solution filtering / blending (averaging,
    multi-resolution texture, )

24
Texture Mapping
Shape distortion
25
Texture Mapping
Shape distortion
Original texture map
Linear transformation
Bilinear transformation
Perspective transformation
26
Texture Mapping
Aliasing distortion
Pixel popping (or crawlies) pixels appear
and disappear during animation
27
Texture Mapping
  • Aliasing distortion
  • Texture shrunk ? / stretched ? onto screen
    polygon
  • ? minification problem pixel corresponds to many
    texels
  • abrupt changes in appearance (e.g. scintillation)
  • solution texture blurring and map size reduction
  • ? magnification texel corresponds to many pixels
  • blocky appearance
  • solutions
  • use larger texture map (may be precluded by
    storage limitations)
  • combine texture map with approximation of edges,
    and increase map size

28
Texture Mapping
  • Anti-aliasing techniques
  • Mip-mapping
  • multiple texture maps at different resolutions
  • obtained by blurring higher-resolution map and
    reducing size
  • e.g. averaging of groups of 4 texels
  • selection of texture map determined by e.g.
    screen size of object being mapped
  • Reduces aliasing but increases computation and
    storage cost

29
Relief Mapping
  • Bump mapping
  • distortion of smooth surface to give illusion of
    wrinkles or dimples
  • i.e. change of curvature
  • small perturbations applied to orientation of
    local surface normals
  • perturbation derived from height field specified
    in bump map
  • perturbed normals used in intensity calculation
  • result in variation of diffuse and specular
    components of reflected light

30
Relief Mapping
  • Bump mapping

surface normal
perturbation related to local curvature of
surface and of height map
perturbed surface normal
31
Relief Mapping
32
Reflection Mapping
  • Reflection of environment wrapped onto object
    surface
  • object shows reflections of surrounding world
  • rough / blurry reflection (chrome mapping)
  • recognisable image of world (environment mapping)
  • can also be used to simulate specular highlights
  • map depicting bright spot(s) representing
    reflection of light source

33
Reflection Mapping
34
Reflection Mapping
  • Environment mapping
  • two-part mapping
  • pre-computation real or synthetic image of
    environment wrapped onto enclosing volume
    (sphere, cube, )
  • computational simplification object centred
    within and much smaller than enclosing volume
  • ray reflected by object approximated by ray from
    centre of enclosure

35
Reflection Mapping
  • two-part mapping (ctd.)
  • run-time rendering
  • calculate reflected ray for ray incident from
    eye onto each object vertex
  • (formula refer to specular reflection model)
  • reflected ray use to index into reflection map
  • interpolate across polygon

36
Suggested Reading
  • Relevant parts of Ch. 14, D. Hearn, M.P. Baker,
    Computer Graphics, 2nd Ed. in C, Prentice-Hall,
    1996.
  • Relevant parts of Ch. 12, A. LaMothe, Black Art
    of 3D Game Programming, Waite Group Press, 1995.
  • A. LaMothe, Affine Texture Mapping, Dr. Dobbs
    Journal, pp. 58 - 63, July 1998.
  • P.S. Heckbert, Survey of Texture Mapping, IEEE
    Computer Graphics and Applications, pp. 56 - 67,
    Nov. 1986.

37
Summary
  • Mapping techniques can produce realistic surface
    details for little geometric complexity
  • e.g. colour, bump, or environment mapping
  • Texture mapping
  • stretch / shrink texture onto surface
  • requires coordinate transformation
  • image-order scanning is popular
  • enhanced realism but may suffer from aliasing and
    shape distortion

38
Summary
  • Bump mapping
  • perturbation of surface smoothness
  • Environment mapping
  • generation of reflection of environment on object
    surface
Write a Comment
User Comments (0)
About PowerShow.com