Title: Fractals
1Fractals Grammarsin GraphicsComp 575 - Fall
2008
2Texturing with Images
- Texture maps with images are good because images
are (sometimes) easy to create. - In some cases, just taking a picture is easier
than writing a program to generate the picture. - Images are hard to get for things that arent
real. - Images consume space.
- Images have finite precision.
3Procedural Methods.
- Write a program to generate the texture.
- Save space.
- In some cases, can zoom in forever and retain
precision - Hard to write the right procedure.
- However, ideas based on fractals go a long way.
- Especially for objects in nature.
4Euclidean vs. Fractal
- Standard objects are represented in Euclidean
geometry - Described by equations
- This gives smooth, regular objects
- Spheres
- Polygons
- B-spline surfaces
- How do we model natural objects?
- Clouds
- Mountains
- Plants
- These kinds of objects are better represented
with fractal geometry
5What is a Fractal?
- Benoit Mandelbrot, 1982,
- clouds are not spheres, mountains are not
cones, coastlines are not circles, and bark is
not smooth, nor does lightning travel in a
straight line. - Objects are represented as procedures rather than
equations - Repeating the fractal procedure produces more and
more detail
6Properties of Fractals
- Self-similarity between object parts and the
overall object features - Fractional dimension
- No specific size or scaling
- Infinite detail looks good at every resolution
- Generated by a function, so no data to store.
- Some of them look like things you find in nature.
7Fractal Mountain
The closer you get, the more detail you see
8Fractal Generation
- A fractal object is generated by repeatedly
applying a specified transformation - Can apply the transformation to a point set, set
of primitives (lines, curves, colors ,etc.), or
anything else - Theoretically, the procedure is applied an
infinite number of times - Practically, we only need to iterate a few times.
9Fractal Dimension (Hausdorff variant)
Split into ¼ the size and multiply by
4 Build original by splitting into 4 parts
and multiplying by 4
Split into ¼ the size And multiply by 16
42 Build original by splitting into 4 parts
and multiplying by 42
Build original by splitting into 4 parts and
multiplying by 43
10Fractal Dimension (Hausdorff variant)
Split into ¼ the size and multiply by
4 Build original by splitting into 4 parts
and multiplying by 4
Split into ¼ the size And multiply by 16
42 Build original by splitting into 4 parts
and multiplying by 42
Build original by splitting into 4 parts and
multiplying by 43
11Fractal Dimension (Hausdorff variant)
12Sierpinski Triangle
- Take a triangle.
- Reduce by ½
- Make 3 copies and arrange them into a triangle
- Repeat forever.
13Sierpinski Triangle
14Cantor Set
- Lots of interesting and counter-intuitive
properties - Uncountably infinite number of points.
- Lebesgue measure of 0.
- What is its fractal dimension?
- Reduce by 1/3
- Make 2 copies
15A Few Examples
Penrose tiling 1.974 (a non-periodic tiling)
Cauliflower 2.33
Menger sponge 2.726
http//en.wikipedia.org/wiki/List_of_fractals_by_H
ausdorff_dimension
16c. 13 branches each 1/3 smaller, D
log(13)/log(3) 2.33
17Fractals in Nature
http//www.funpike.com/images/plant-bushes/2fracta
l_nature_1.jpg
http//www.treklens.com/gallery/Oceania/New_Zealan
d/photo22113.htm
18Fractal Classification
- Self-similar fractals
- Parts are scaled-down versions of the initial
object - Deterministic self-similar
- Non-random
- Statistically self-similar
- Some randomness introduced
- Self-affine
- Different scaling parameters in each coordinate
direction - Invariant Fractal Sets
- Formed with nonlinear transformations
- Sets in the complex plane (usually)
19Self-Similar Fractals
- Parts are scaled-down versions of the entire
object - Start with the initial shape
- Construct sub-parts by duplicating the initial
shape and scaling it - Can apply different scaling factors for different
parts - Example
- The von Koch snowflake
- Can also introduce random variations to the
sub-parts - These fractals are statistically self-similar
- Typically used to model trees, shrubs, and other
plants
20Von Koch Snowflake
- Start with initiator
- And generator
- At each iteration, replace each piece of the
initiator with the generator
21Von Koch Snowflake
22Von Koch Snowflake
23Von Koch Snowflake
24Von Koch Snowflake
25Other Self-Similar Fractals
26Peano Curve
1st Iteration
2nd Iteration
3rd Iteration
27Statistically Self-Similar Fractals
- Self-similar fractals in which random variations
are made to the sub-parts - Typically used to model trees, shrubs, and other
plants
Marco Bubkewww.xfrogdownloads.com
Bernd Lintermann www.xfrogdownloads.com
28L-systems
- Lindenmayer systems
- Invented by a biologist
- Used to describe plant growth
- Formal Grammar
- Rewrite a bunch of symbols in parallel.
29Fibonacci Numbers as an L-system
- variables A B
- start A
- rules A ? B
- B ? AB
- This L-system produces the following sequence of
strings - n 0 A
- n 1 B
- n 2 AB
- n 3 BAB
- n 4 ABBAB
- n 5 BABABBAB
- n 6 ABBABBABABBAB
- n 7 BABABBABABBABBABABBAB
- Count the length of each string 1,1, 2, 3, 5, 8,
13, 21, 34,
30Cube-Free
- Is it possible to create a string of 0s and 1s
where no substring repeats three times? - No substrings like 000, 010101, or 101101101
- This is called the cube-free property.
- Yes, the Thue-Morse Sequence.
- Under some rules of chess, you can have an
infinitely long game without a stalemate.
31Thue-Morse Sequence
- variables 0 1
- start 0
- rules 0 ? 01
- 1 ? 10
- n 0 0
- n 1 01
- n 2 0110
- n 3 01101001
- n 4 0110100110010110
- n 5 0110100110010110 1001011001101001
- n 6 0110100110010110 1001011001101001
- 1001011001101001 0110100110010110
32Von Koch Snowflake
- Start with initiator
- And generator
- At each iteration, replace each piece of the
initiator with the generator
33L-systems Used to Model Plant Growth
34Fractal Trees
35Trees using L-systems
36Modeling Venation Patterns
37Split Grammars for Buildings
38Results using Split Grammars
39Midpoint Displacement
40Midpoint Displacement
41Midpoint Displacement
42Invariant Fractal Sets
- Formed with non-linear transformations
- Includes the self-squaring fractals and the
self-inverse fractals
43Mandelbrot Set
- Iterate over a complex function
- Color the point in space based on how quickly the
function diverges at that point - Points that do not diverge are in the set
- The set is typically colored black, points that
diverge at different speeds are colored
accordingly
44The Mandelbrot Set
45Zooming into the Mandelbrot Set
http//www.softlab.ntua.gr/miscellaneous/mandel/ma
ndel.html
46Computing the Mandelbrot Set
For each pixel on the screen do x x0
// x co-ordinate of pixel y y0 // y
co-ordinate of pixel x2 xx y2 yy
iteration 0 maxIteration 1000 while (
x2 y2 lt (22) iteration lt maxIteration )
y 2xy y0 // Complex
Multiplication x x2 - y2 x0 x2 xx
y2 yy iteration iteration 1
if ( iteration maxIteration ) color
black else color iteration
47Fractal Mountains
- Start with the basic shape of the mountain
- Subdivide edges of the shape
- Randomly perturb the new vertices
- Repeat recursively
- 2D for coastlines
- 3D for mountains
48Fractal Terrain Results
49Terrain
50Terrain
Other effects like erosion can be added.
51Terrain
52Other Uses of Fractals
53Other Uses of Fractals
54Other Uses of Fractals
55Procedural Textures - Perlin Noise
- Instead of perturbing the geometry perturb
texture values. - http//www.noisemachine.com/talk1/20.html
- http//blip.tv/file/760578/