Procedural Texturing and Modeling Advanced Animation and Motion Capture (AA&MC)

Preview:

Citation preview

Procedural Texturingand

Modeling

Advanced Animation andMotion Capture (AA&MC)

Topics covered:

Fractals & Noisea. Randomb. Pseudo-randomc. Perlin Noised. Iterated functionse. Spiral Phyllotaxis

2D and 3D Texturesa. Surface texturesb. Cellular texturesc. 3D Texturesd. Hypertextures

Grammarsa. Recursionb. L-Systems

Procedural Modelinga. Instancingb. Replicationc. Placement

NoiseWhat is randomness?

Randomness:

Some definitions…

“Having no definite aim or purpose; not sent or guided in a particular direction..” Oxford English Directionary

“Free will is limited to low-level decision making.” Martin Luther

“God does not play dice with the universe.” Albert Einstein

“Don’t tell God what to do.” Neils Bohr

“[God] gave humans free will. He gave them free will because aworld of mere automata could never love..” C.S. Lewis

Randomness in the universe implies free will.

Michael Noll, 1962. Computer Composition with LinesBased on Piet Mondrian’s Composition with Lines

Bela Julesz, Hungarian psychologistRandom-dot stereograms. 3D object hidden in random images.

Is it random? What makes it random?

How do we get true randomnesss?

Which of these are random?

a. Throwing dice

b. Roulette wheel

c. Temparature of a specific point in nature

d. The next number I say

e. Digits of PI

Roulette wheel

The Eudaemonic Pie, 1985. Thomas A. Bass.

Describe a group of physics graduates from University of Santa Cruz whoknew that roulette wheels obey Newtonian physics, but is justvery sensitive to initial conditions. Using miniaturized computers, hidden in special shoes, they could capture the state of the ball and the wheel, and could increasetheir odds by 44%.

Hardware Random Number Genarators

Best sources of physical randomness so far:- Nuclear decay of atoms.- Photos traveling through a partial mirror

SSL Accelerator card Applications to cryptography.Many security systems are based on a random key.If the key is not really random, system is not safe.

How do computers generate random numbers?

Numbers are generated as a sequence, starting from some seed point.Problem is finding the next number so that it has nothing to do with the last.

Why is this hard? Because computers are deterministic. The computer program to get Tn+1 is an exact sequence of steps. So if youfigure out what is Tn, my program will give you Tn+1.Computer has no free will to choose a different number.

?

Tn Tn+1

Plot of the rand() function in C.

int r = rand();

When your computer really needs something random, how does it do it?

srand ( time() ); // check the second hand on the clock

int r = rand(); // get random number

This says the seed of the random number generator is based on the when you tell the program to run.

All numbers after that will look random.If you start the program over, a different clock timeis used for the sequence.

These are called pseudo-random sequences.

Randomness in Computer Graphics

We actually like pseudo-random sequences in graphics.

Why?

1. Results can be reproduced, while still appearing random. Useful for testing.

2. Randomness that depends on time will not jump around from one frame to the next. e.g. Random placement of trees in a game.

3. Faster to compute

Computer Graphics

Patterns in nature are semi-random.

Wood chips.

Sheet metal

Random noiseScaled on one axis

Natural and Man-Made Patternsoften have a grain.

Wood – due to process of growthMetal – due to process of cleaning

Fractals

Nature often exhibits pattens of a fractal structure.

“Clouds are not spheres, mountains are not cones, coastlines are not circles, and bark is not smooth..”

Benoit Mandelbrot, French-American (b. 1924)The Fractal Geometry of Nature, 1982

- Exhibit scale invariance. Same structure at different scales.

- Exhibit self-similarity.

- Exhibit Fractal dimensionality.

Perlin Noise

Fractal noise.

Simple idea: Generate random noise at different scales (frequencies) and add them together.

Ken Perlin, New York University.Invented in 1982. Academy award for Tron.

ChaosThe property of a non-linear system to be stable at times, but occasionally enter into a chaotic, seemingly-random state.

Exhibited by many physical systems:

Simple Example – Logistic Map

Based on the logistic map, developed to study population dynamics.

x = r x ( 1 – x )

Creates a number sequence. Where:

0 < Xn < 1 Ratio of existing populaton to maximum possible population. % population

r Combined rate for reproduction and starvation.

So we have two competing factors:r Xn Says that population will increase based on

the previous population.

r (1-Xn) Says that population will decrease based due to starvation based on how close we are to maximum.

n+1 n n

Biologist Robert May, 1976. Mathematics first from Pierre Francois Verhulst (1804)

Bifurcation Diagram

Iterated Functions

All these systems share a common feature:

How to Generate a sequence Tn+1 from Tn.

- Noise Generator is pseudo-random sequence

- Roulette Generator is the law of Newtonian physics

- Chaos Generator is a non-linear system /w feedback

- Logistic Map Generator is competition between population factors

Iterative functions describe many basic processes in nature.The previous state of the system determines the next state.

See the chaos game, Michael Barnsley. Method of making geometric fractals.

Spiral Phyllotaxis

Many patterns in nature can be understood withvery simple iterated functions.

Wilhelm Hofmeister, 1868.

Two leaves appear on opposite sides. A third appears between them.The first two push the 3rd away. The result is the golden angle.

Iteration, adding new leaves, settles into the minimization of energy,which results in the golden ratio (angle).

Fermat’s Spiral

o

Phyllotaxis pattern found in sunflowers.

A Collision-based Model of Spiral Phyllotaxis, 1992Deborah Fowler, Przemyslaw Prusinkiewicz, Johannes Battjes

http://algorithmicbotany.org/papers/#abop

“The Algorithmic Beauty of Plants”

Przemyslaw Prusinkiewicz

Entire book available online:

Procedural Textures – 2D and 3D

Deals specifically with generated images and volumesand their application to graphics.

f ( x, y ) = image

f ( x, y, z) = volume

Procedural Textures – 2D and 3D

f ( x, y ) defines an image, or surface texture.

Image f ( x, y )

Object Polygon

World space Texture space

Texture mapping. Two-dimensional function is mapped onto thethree dimensional geometry. Process is usually done withinverse sampling, where you look up the desired value in f.

Texture mappingTexture appears on surface, and follows surface distortions of the object.

Volumetric Textures

f ( x, y, z) Texture is defined at every point in space.

f ( x, y, z ) defines a volume texture

Volume f ( x, y, z )Object Polygon

World space Volume Texture space

Texture color is selected directly from the 3D volume location.

Wood and marble are naturallydescribed as volumetric textures.

Modeling and Rendering of Weathered StoneJulie Dorsey, Alan Edelman, Henrik Jensen, Justin Legakis, Hans Pedersen

Combine Perlin noise with other simluated physical processes, such as rain or rust, and layer them together.

Texture mapping:

- Faster to compute

- Less memory to store (only if you need to save)

- Texture appears on the surface of object

- Texture distorts with changes in the object.

Volume textures:

- Slower to compute

- More memory to store (only if you need to save)

- Texture remains rigid relative to object.

- Object changes in shape will move through the texture.

- Good for rigid objects with cracks or breaks.

Cellular Textures

There are other ways to generate the texture function f ( x, y )aside from using random noise.

Generate a set of polygonsin the plane (2D).

Compute the distance tothe nearest edge.

Crocodile skin

Procedural Texturing – Types of mappings

Texture mapping assigns a function f to the color of a point on an object.

Different features of an object can be modified by procedural textures.

Bump mapping modifies the surface normal based on the function f.

The surface normal determines the visible orientation of the surface for lighting calculations.

Notice the silouette doesnot look bumpy.

The geometry is not changed, only the surface direction relativeto the light source.

Procedural Texturing – Types of mappings

Environment mapping modifies the reflected ray color based on function f.

Procedural Texturing – Types of mappings

Useful for reflective surfaces.

Notice that the geometry of the surface is still not changed.The sphere is still smooth.

Displacement mapping modifies the actual surface position based on function f.

Procedural Texturing – Types of mappings

Most realistic for any rough surface.Notice silouette is also bumpy.

Can be expensive to compute. May need to increase the geometricdetail of the object in order to give a good appearance.

Grammars and L-Systems

How can we change the structure of something?

With procedural textures there is essentially one object, the function or system, which can change over time. Differences are between points in space or sequences in time.

What if we want to modify the objectitself, change its change or add new shapes?

Example:

Aristid Lindenmayer, 1968. Hungarian biologist and botanist.

L-Systems

Process of replacement can be formalized using a grammar,or parallel rewriting system, called an L-system.

An L-system is a tuple (set of three things):

G = ( V, w, P )

V = Alphabet. Set of symbols that can be replaced.

w = Start or axiom.

P = Set of production rules.

Variables: A B

Start: A

Rules: A -> B B -> AB

Process:

1. Take the Start (w) as the current string2. Apply the production rule to every symbol in the current string.3. When finished, call this the new string.4. Repeat

start: Aiteration 1: B (rule A->B)iteration 2: AB (rule B->AB)iteration 3: BAB (rules A->B, B->AB)iteration 4: ABBAB (rules B->AB, A->B, B->AB)

L-Systems can have a physical interpretation, if we assign meaning to letters.

L-System Plants

L-system Weeds

Procedural Cities

L-systems can be used to describe many objects where thestructure changes iteratively, such as city blocks.

http://www.youtube.com/watch?v=yI5YOFR1Wus

Procedural Buildings

Generative Modeling Language (GML)“A Generative Theory of Shape”, Michael Leyton. (availabe online)

Procedural Furniture

Parametric modeling allow you to change the size and shapeof various parts of an object continuously.

Instancing and Replication

L-system

or.. How to make a complete forest. (First try)

Structureof branches

Noise

Noise can tell us where to plant trees.L-system can tell us how to build a three-dimensional tree.

But do we make one tree and copy it, or do we make lots of different trees?

Some times instancing can look pretty good. Pines trees all look similar.

In other cases, instancing does not produce enough visual variation.This also depends on the placement algorithm.

1 instance

2 instances

1 instance

8 instances

http://www.youtube.com/watch?v=rl5p63JabrA

Procedural Modeling - Efficiency

Procedural modeling can produce a lot of geometry.

Steps must be taken to reduce the number of polygons.

1. Level of detail – Only create new geometry where it is needed 2. Instancing – Copy geometry already in memory instead of rebuilding

3. Imposters – Use a picture for distant objects instead of rendering the whole thing.

1

2

3

Recommended