classic mapping technique

79
Classic mapping technique 7.1 Introduction 7.2 Two-dimensional texture maps to polygon mesh objects 7.3 Two-dimensional texture domain to bi-cubic parametric patch objects 7.4 Bump mapping 7.5 Environment or reflection mapping 7.6 Three-dimensional texture domain techniques 7.7 Comparative examples

Upload: nathan-trevino

Post on 01-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

Classic mapping technique. 7.1 Introduction 7.2 Two-dimensional texture maps to polygon mesh objects 7.3 Two-dimensional texture domain to bi-cubic parametric patch objects 7.4 Bump mapping 7.5 Environment or reflection mapping 7.6 Three-dimensional texture domain techniques - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Classic mapping technique

Classic mapping technique7.1 Introduction7.2 Two-dimensional texture maps to polygon mesh

objects7.3 Two-dimensional texture domain to bi-cubic

parametric patch objects7.4 Bump mapping7.5 Environment or reflection mapping7.6 Three-dimensional texture domain techniques 7.7 Comparative examples

Page 2: Classic mapping technique

7.1 Introduction The mapping technique

Techniques which store information in a 2D domain which is used during rendering to simulate textures.

Texture mapping The mainstream application

Reflection mapping Simulate ray tracing

Page 3: Classic mapping technique

7.1 Introduction Environment mapping

Add pseudo-realism to shiny animated objects by causing their surrounding environment to be reflected in them.

Color mapping Texture - does not mean controlling the micro-

facets of the objects controlling the value of the diffuse coefficients Shading changes as a function of the texture maps.

Page 4: Classic mapping technique

7.1 Introduction Three origins to the difficulties

How can we physically derive a texture value at a surface point if the surface does not exits.

How to map a 2D texture onto a surface that is approximated by a polygon mesh.

Aliasing problem

Page 5: Classic mapping technique

Possible ways to modulate a computer graphics model with a texture map Color

Modulate the diffuse reflection coefficients in the local reflection model.

Specular color (environment mapping) Special case of ray tracing

Normal vector perturbation (bump mapping) Applies perturbation to the surface normal according to the correspon

ding value in the map. Displacement mapping

Uses a height field to perturb a surface point along the direction of its surface normal.

Transparency Used to control the opacity of a transparent object

Page 6: Classic mapping technique

Ways to perform texture mapping Choice depend on

Time constraints Quality of the image required

We will restrict the discussion to 2D texture maps. (Heckberts 1986)

2D Texture mapping 2D-to-2D transform

2D texture object surface screen space

can be viewed as an image warping operation

Page 7: Classic mapping technique

Ways to perform texture mapping Forward mapping

Two stages process 2D texture space -> 3D object space

Parametrisation Associates all points in texture space with points on the object

surface 3D object space 2D screen space

Projective transform

Inverse mapping For each pixel we find its corresponding pre-image in text

ure space.

Page 8: Classic mapping technique

Two ways of viewing the process of 2D texture mapping

(a) Forward mapping (b) Inverse mapping

Page 9: Classic mapping technique

7.2 Two-dimensional texture maps to polygon mesh objects

7.2.1 Inverse mapping by bi-linear interpolation

7.2.2 Inverse mapping by using an intermediate surface

7.2.3 Practical texture mapping

Page 10: Classic mapping technique

7.2.1 Inverse mapping by bi-linear interpolation Inverse mapping

Consider a single transformation for 2D screen space (x,y) to 2D texture space (u,v). An image warping, can be modelled as a rational linear project

ive transform:

We can write this in homogeneous coordinates as :

Page 11: Classic mapping technique

The inverse transform If we have the association for the four vertices of a q

uadrilateral we can find the nine coefficients (a,b,c,d,e,f,g,h,i)

Page 12: Classic mapping technique

Bi-linear interpolation in screen space Assuming vertex coordinate/texture coordinate for all polygons we c

onsider each vertex to have homogeneous texture coordinates:

Use normal bi-linear interpolation scheme within the polygon, using homogeneous coordinates as vertices to give (u’,v’,q) for each pixel; then the required texture coordinates are give by:

zqqvvquuwhere

qvu

/1,/,/:

),,(

)/,/(),( qvquvu

Page 13: Classic mapping technique

7.2.2 Inverse mapping by using an intermediate surface Used when there is no texture coordinate-vertex coor

dinate correspondence. It can be used as a preprocess to determine the corres

pondence. Two-part texture mapping:

To overcome the surface parametrisation problem Introduced by Bier and Sloan (1986)

The intermediate surface must has an analytic mapping function.

Page 14: Classic mapping technique

Two-stage forward mapping process First stage : S mapping

2D texture space to 3D intermediate surface

Second stage : O mapping 3D texture pattern onto object surface.

),,(),( iii zyxTvuT

),,(),,( wwwiii zyxOzyxT

Page 15: Classic mapping technique

Two-stage forward mapping process

Page 16: Classic mapping technique

S mapping Bier describes 4 intermediate surfaces

A plane at any orientation The curved surface of a cylinder The faces of a cube The surface of a sphere

For example Given a parametric definition of the curve surface of a cylinder as a set

of points (,h)

c , d are scaling factors θ0 and h0 position the texture on the cylinder of radius r.

Page 17: Classic mapping technique

Four O mapping

Page 18: Classic mapping technique

Inverse mapping using the shrink wrap method

Page 19: Classic mapping technique

Inverse mapping using the shrink wrap method

Inverse mapping

Page 20: Classic mapping technique

Examples Examples of mapping the same texture onto an object using different

intermediate surfaces

Page 21: Classic mapping technique

7.2.3 Practical texture mapping

Page 22: Classic mapping technique

7.2.3 Practical texture mapping An example of a tank object texture being created from a photograph

of a tank

Page 23: Classic mapping technique

7.2.3 Practical texture mapping Interactive texture mapping-pain

ting in T (u,v) space

Page 24: Classic mapping technique

7.2.3 Practical texture mapping Agglomerating part maps into a single texture map.

Page 25: Classic mapping technique

7.3 Two-dimensional texture domain to bi-cubic parametric patch objects The parametrization is trivial

P (u,v) T (s,t) Catmull (1974)

Subdivide patch in object space, and at the same time subdivide corresponding texture in texture space.

Patch subdivision proceeds until it covers a single pixel Cook (1987)

Object surfaces are subdivided into micro-polygons and flat shaded with values from a corresponding subdivision in texture space

Page 26: Classic mapping technique

7.3 Two-dimensional texture domain to bi-cubic parametric patch objects Example

Page 27: Classic mapping technique

7.4 Bump mapping7.4.1 A multi-pass technique for bump mapping

7.4.2 A pre-calculation technique for bump mapping

Page 28: Classic mapping technique

7.4 Bump mapping Developed by Blinn in 1978 An elegant device that enables a surface to ap

pear as if it were wrinkled or dimpled without the need to model these depressions geometrically.

The only problem Silhouette edge that appears to pass through a dep

ression will not produce the expected cross-section

Page 29: Classic mapping technique

A one-dimensional example of the stages involved in bump mapping

Page 30: Classic mapping technique

The surface and its normal Assuming the surface is defined by a bivariate parametric fun

ction P(u,v) The surface normal on each point of the surface is then define

d as

Pu and Pv are the partial derivatives lying in the tangent plane to the surface at point P

vu PPv

P

u

PN

Page 31: Classic mapping technique

The displaced surface and it’s surface normal The new displaced surface P’(u,v)

Two-dimensional height field B(u,v) called bump map

The new surface normal on P’

NvuBvuPvuP ),(),(),(

vu PPN

Page 32: Classic mapping technique

The partial derivatives of P’ and the new surface normal on P’ The partial derivatives of P’

If B is small we can ignore the final term so N’ become:

D is a vector lying in the tangent plane that pull N into the desired orientation and is calculated from partial derivatives of the bump map and the two vectors in the tangent plane.

vvvv

uuuu

NvuBNBPP

NvuBNBPP

),(

),(

DN

BBABN

PNBPNBNN

or

NPBPNBNN

vu

uvvu

uvvu

)(

Page 33: Classic mapping technique

Geometric interpretation of bump mapping

Page 34: Classic mapping technique

7.4.1 A multi-pass technique for bump mapping McReynolds and Blythe (1997) define a multi-pass tech

nique. They split the calculation into two components. The fina

l intensity value is proportional to N’. L

First component : the normal Gouraud component Second component : found from the differential coefficient of t

wo image projections

LDLNLN

Page 35: Classic mapping technique

A multi-pass technique for bump mapping (cont.) To do this it is necessary to transform the light vector into t

angent space at each vertex of the polygon. This space is defined by N, B, T N is the vertex normal T is the direction of increasing u (or v) in the object space coordia

nte system B = N T

Normalised components of these vectors defines the matrix that transforms point into tangent space

1000000

zyx

zyx

zyx

TS NNNBBBTTT

L

Page 36: Classic mapping technique

A multi-pass technique for bump mapping (cont.) Algorithm is as follows

Page 37: Classic mapping technique

7.4.2 A pre-calculation technique for bump mapping Tangent space can also be used to facilitate a pre-calculation techni

que as proposed by Peercy et al. (1997) It can be shown that the perturbed normal vector on tangent space g

iven by

vu

vuuv

vu

TS

PPc

PTBPBb

PBBa

where

cba

cbaN

))((

)(

)(

,,2/1222

Page 38: Classic mapping technique

Example for bump mapping A bump mapped object with the bump map

Page 39: Classic mapping technique

Example for bump mapping A bump mapped object from a procedurally

generated height field.

Page 40: Classic mapping technique

Example for bump mapping Combining bump and color mapping

The bump and color map

Page 41: Classic mapping technique

7.5 Environment or reflection mapping 7.5.1 Cubic mapping 7.5.2 Sphere mapping 7.5.3 Environment mapping : comparative

points

Page 42: Classic mapping technique

7.5 Environment or reflection mapping Originally called reflection mapping

Suggested by Blinn (1977) Consolidated into mainline rendering techniques in an im

portant paper in 1986 by Greene Used to approximate the quality of a ray-tracer for sp

ecular reflections It is a classic partial offline or pre-calculation techni

que V Rv M(Rv)

Page 43: Classic mapping technique

7.5 Environment or reflection mapping

Page 44: Classic mapping technique

7.5 Environment or reflection mapping Example

Page 45: Classic mapping technique

Disadvantages Correct only when the object becomes small

with respect to the environment that contains it.

An object can only reflects the environment – not itself.

A separate map is require for each object. A new map is required whenever the view poi

nt changes

Page 46: Classic mapping technique

Environment mapping VS. ray tracing

Page 47: Classic mapping technique

Three methods for environment mapping Cubic mapping Latitude-longitude mapping sphere mapping

Page 48: Classic mapping technique

7.5.1 Cubic mapping

Page 49: Classic mapping technique

7.5.1 Cubic mapping A problem of a cubic map is

that if we are considering a reflection beam formed by pixel corners, or equivalently by reflected view vectors at a polygon vertex , the beam can index into more than one

map.

Page 50: Classic mapping technique

Cubic environment map convention

Page 51: Classic mapping technique

7.5.2 Sphere mapping Latitude-longitude projection

Blinn and Newell(1976) Rv T (u,v)

Main problem : singularities at the poles As Rvz +1,-1 both Rvx and Rvy 0 and Rvy/Rvx bec

ome ill-defined

Page 52: Classic mapping technique

7.5.2 Sphere mapping Haberli and Segal (1993) and Miller et al. (1998) To generate the map

To index into the map

Page 53: Classic mapping technique

Constructing a spherical map

Page 54: Classic mapping technique

7.5.3 Environment mapping : comparative points Sphere mapping requires only one map, while

cubic mapping needs six maps. Both type of sphere mapping suffer more

from non-uniform sampling than cubic mapping.

Page 55: Classic mapping technique

Sampling the surface of a sphere

Page 56: Classic mapping technique

7.6 Three-dimensional texture techniques

7.6.1 Three-dimensional noise

7.6.2 Simulating turbulence

7.6.3 Three-dimensional texture and animation

7.6.4 Three-dimensional light maps

Page 57: Classic mapping technique

7.6 Three-dimensional texture techniques Difficulties associated with mapping a 2D

texture onto the surface of a 3D object. The reasons for this are : Large variations in the compression of texture Textural continuity across surface elements

Page 58: Classic mapping technique

Mapping How to map object surfaces to texture space

3D to 3D mapping is straightforward, the problems in 2D texture mapping is eliminated

Texture coordinate assignment can be simple as straight mapping, u=x,v=y,w=z (u,v,w) is a coordinate in the texture field.

Page 59: Classic mapping technique

Presentation How to present the texture

layers of 2D iso-surfaces Limited resolution and take up vast memory Easily acquired through 3D layered scanning

procedural texture A method that define procedurally a texture field in object space. save storage space Limited use The color of the object determined by the intersection of its surfa

ce with the texture field Solid Texture (Perlin 1985, Peachey 1985)

Page 60: Classic mapping technique

7.6.1 Three-dimensional noise It is a popular class of procedural texturing te

chnique It uses a 3D noise function as a basic modelin

g primitive It can be used to produce a surprising variety

of realistic natural-looking texture effects

Page 61: Classic mapping technique

Algorithm generation of solid noise Perlin (1985) was the first to suggest this appl

ication of noise. Define a noise function noise() It is called model directed synthesis Evaluate the function only at points of interest

Page 62: Classic mapping technique

Noise function properties Ideally, the function should posses the followi

ng three properties Statistical invariance under rotation. Statistical invariance under translation. A narrow bandpass limit in frequency

The first two conditions ensures that no matter how we move or orientate the noise function in space its general appearance remains the same.

The third condition enables us to sample the noise function without aliasing

Page 63: Classic mapping technique

Perlin’s method of generating noise Define an integer lattice situated at location (i,j,k) Associate a random number with each point of the la

ttice The association can be done in two ways

A look-up table Via a hashing function

The value of the noise function at a point in space For the points on the lattice

The noise value is the associated random number For other points not on the lattice

The noise value can be obtained by linear interpolation from the nearby lattice points

Page 64: Classic mapping technique

Problems with Perlin’s method The function will tends to exhibit directional c

oherence Can be ameliorated by using cubic interpolation

Expensive The coherence still tend to be visible

Alternative methods Lewis (1989)

Page 65: Classic mapping technique

7.6.2 Simulating turbulence The most versatile of its applications is the use of the s

o-called turbulence function Takes a position x and returns a turbulent scalar value The 1D version defined as

turbulence (x)=

The summation is truncated at k which is the smallest integer satisfying < the size of a pixel

Exhibits self-similarity Power spectrum obeys a 1/f power law

k

ii

i xnoiseabs

0

)2

)2((

12

1k

Page 66: Classic mapping technique

Two stages in the process of simulating turbulence Representation of the basic, first order, structu

ral features of a texture through some basic functional form.

Addition of 2nd and higher order detail by using turbulence to perturb the parameters of the function.

Page 67: Classic mapping technique

Example : the marble The basic function form

marble(x) = marble_color(sin(x))

Adding turbulence marble(x)=marble_color(sin(x+turbulence(x))

Page 68: Classic mapping technique

Example : the marble

Page 69: Classic mapping technique

Remark The use of turbulence function need not be res

tricted to modulated just the color of an object Surface bumps

Oppenheimer(1986) Turbulates a sawtooth function to bump map the ridges of bark on the tree.

Transparency Density

Page 70: Classic mapping technique

7.6.3 Three-dimensional texture and animation Define turbulence function over time as well a

s space simply by adding an extra dimension representing time to the noise integer lattice. Lattice point indices (i,j,k,l) Noise function: noise (x,t)

Page 71: Classic mapping technique

Example : simulate fire Basic form: the flame shape

First define a flame region in the xy plane Flame color in this region is given by

)),()/((_)/1()( txturbulencebxabscolourflamehyxflame

Page 72: Classic mapping technique

Example : simulate fire The turbulated form

Flame (x,t) = (1-y/h) flame_colour(abs(x/b)+burbulence(x,t))

Page 73: Classic mapping technique

Convection flame(x,t) =

(1-y/h) flame_color(abs(x/b)+turbulence(x+(0,ty,0),t))

Page 74: Classic mapping technique

7.6.4 Three-dimensional light maps A method of caching the reflected light at eve

ry point in the scene. Store reflected light at a point in a 3D structur

e that represents object space The practical restriction is the cost of vast me

mory resources.

Page 75: Classic mapping technique

7.7 Comparative examples 7.7.1 Figure 7.23

7.7.2 Figure 7.24

7.7.3 Figure 7.25

Page 76: Classic mapping technique

7.7.1 Figure 7.23

Page 77: Classic mapping technique

7.7.2 Figure 7.24

Page 78: Classic mapping technique

7.7.2 Figure 7.24 Shadow and environment map

Page 79: Classic mapping technique

7.7.3 Figure 7.25