procedural textures jian huang, cs594, fall 2002 this set of slides references slides used at ohio...

40
Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Upload: virginia-collar

Post on 16-Dec-2015

218 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

Jian Huang, CS594, Fall 2002

This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Page 2: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Introduced by Perlin and Peachey (Siggraph 1989)

• look for book by Ebert et al: “Texturing and Modeling: A Procedural Approach”

• it’s a 3D texturing approach (can be used in 2D of course)

Page 3: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

What is procedural texture

• Procedural techniques are usually considered to be code segments or algorithms that specify some characteristic of a computer-generated model or effect

• Example: procedural texture for a marble surface does not use a scanned-in image to define the color values

Page 4: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Why Use That?

• The most important and foremost reason: abstraction– Abstract complex scene into a function or an

algorithm (I.e. procedure)

Page 5: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Pros?• Storage savings for details (compact)• No fixed resolution, a great range of detail no matter how

close you look• Can cover arbitrarily large space

• Reduce the time of specifying the details from the programmer to computer

• Power to control parameters that meter meaningful concepts, e.g. the roughness of a mountain

• Flexibility, spend time on the essence of the object or phenomenon

Page 6: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Cons?

• Very difficult to build and debug an implicit pattern description

• Surprise

• Slow to compute

• Aliasing

A stochastic process

Page 7: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Gets around a bunch of problems of 2D textures– deformations/compressions– worrying about topology

• analogous to sculpting or carving

Page 8: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Object Density Function D(x)– defines an object, e.g. implicit description or

inside/outside etc.

• Density Modulation Function (DMF) fi

– position dependent– position independent– geometry dependent

• Hyper-texture: H(D(x),x) = fn(…f2(f1(D(x))))

Page 9: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Base DMF’s:– bias

• used to bend the Density function either upwards or downwards over the [0,1] interval. The rules the bias function has to follow are:bias(b,0)=0 bias(b,.5)=b bias(b,1)=1

• The following function exhibits those properties:

• bias(b,t) = t^(ln(b)/ln(0.5))

b = 0.25

b = 0.75

Page 10: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

– Gain• The gain function is used to help shape how fast the

midrange of an objects soft region goes from 0 to 1. A higher gain value means the a higher rate in change. The rules of the gain function are as follows:

gain(g,0)=0 gain(g,1/4)=(1-g)/2 gain(g,1/2)=1/2 gain(g,3/4)=(1+g)/2 gain(g,1)=1

Page 11: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

– Gain• The gain function is defined as a spline of two bias

curves: gain(g,t)= if (t<0.5) then bias(1-g,2*t) else 1-bias(1-g,2-2*2t)/2

G = 0.25 G = 0.75

Page 12: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Source of Randomness

– Noise• some strange realization that gives smoothed values

between -1 and 1

• creates a random gradient field G[i,j,k] (using a 3 step monte carlo process separate for each coordinate)

Page 13: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Noise

• Set all integer lattice values to zero

• Randomly assign gradient (tangent) vectors

Page 14: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Simple Noise

• Hermite spline interpolation• Oscillates about once per coordinate• Noisy, but still smooth (few high frequencies)

Page 15: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures– Noise

• for an entry (x,y,z) - he does a cubic interpolation step between the dot product of G and the offset of the 8 neighbors of G of (x,y,z):

132

),,(,,

,,

23

,,,,

1 1 1

,,

ttt

wvuGwvuwvu

kzjyix

kjikji

x

xi

y

yj

z

zkkji

Page 16: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

– turbulence• creates “higher order” noise - noise of higher

frequency, similar to the fractal brownian motion:

))2(2

1( xnoiseabs i

ii

Page 17: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Turbulence

• Increase frequency, decrease amplitude

Page 18: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Turbulence

• The abs() adds discontinuities in the first derivative.

• Limit the sum to the Nyquist limit of the current pixel sampling.

Page 19: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Density Function Models

• Radial Function (2D Slice)

Page 20: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Density Function Models

• Modulated with Noise function.

Page 21: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Density Function Models

• Thresholded (iso-contour or step function).

Page 22: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Density Function Models

• Volume Rendering of Hypertextured Sphere

Page 23: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects (on colormap):– noise:

Page 24: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects (on colormap):– sum 1/f(noise):

Page 25: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects (on colormap):– sum 1/f(|noise|):

Page 26: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects (on colormap):– sin(x + sum 1/f( |noise| )):

Page 27: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects:– noisy sphere

• modify amplitude/frequency

• (Perlins fractal egg)

))(1

1(( fxnoisef

xsphere

Page 28: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Summary:

Page 29: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects:– marble

• marble(x) = m_color(sin(x+turbulence(x)))

– fire )))(1(( xturbulencexsphere

Page 30: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Effects:– clouds

• noise translates in x,y

Page 31: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

• Many other effects!!– Wood,– fur,– facial animation,– etc.

Page 32: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

How do you render that?

• Rendering– solid textures

• keeps original surface

• map (x,y,z) to (u,v,w)

– hypertexture• changes surface as well (density function)

• volume rendering approach

• I.e. discrete ray caster

Page 33: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Simple mesh for tile.

So-so marble

Page 34: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Procedural Textures

Threshold to provide asharp transition.

Page 35: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Good Marble

Page 36: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

More bricks and other bumps.

Page 37: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Wood

Better marbleas well.

Page 38: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Knarly Marble Dude!!

Page 39: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Decent Fire

Page 40: Procedural Textures Jian Huang, CS594, Fall 2002 This set of slides references slides used at Ohio State and “Texturing and modeling” by Ebert, et. al

Other procedures