Title: CS 455 Computer Graphics
1CS 455 Computer Graphics
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. - But
- 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 - But
- 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 iterate a finite number of times,
then call it good.
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
- We can talk about the fractalness of an object
using the fractal dimension - A measurement of how rough the object is
- The fractal dimension is computed using the scale
factor we reduce by, and the number of times we
replicate the scaled down object.
11Fractal 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
12Sierpinski Triangle
- Take a triangle.
- Reduce by ½
- Make 3 copies and arrange them into a triangle
- Repeat forever.
13Sierpinski Triangle
14A Few Examples
Penrose tiling 1.974 Cauliflower 2.33
Menger sponge 2.726
http//en.wikipedia.org/wiki/List_of_fractals_by_H
ausdorff_dimension
15c. 13 branches each 1/3 smaller, D
log(13)/log(3) 2.33
16Fractals in Nature
http//www.treklens.com/gallery/Oceania/New_Zealan
d/photo22113.htm
http//www.funpike.com/images/plant-bushes/2fracta
l_nature_1.jpg
17Fractal 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)
181. Self-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
19Von Koch Snowflake
- Start with initiator
- And generator
- At each iteration, replace each piece of the
initiator with the generator
20Von Koch Snowflake
21Von Koch Snowflake
22Von Koch Snowflake
23Von Koch Snowflake
24Other Self-Similar Fractals
25Statistically Self-Similar Fractals
- Self-similar fractals in which random variations
aremade to the sub-parts - Typically used to model trees, shrubs, and other
plants
Marco Bubkewww.xfrogdownloads.com
Bernd Lintermann www.xfrogdownloads.com
26Self-Affine Fractals
- The scale factor differs for each direction
Self Similar
Self Affine
27Self Affine Fractals
Self Similar
Self Affine
28Invariant Fractal Sets
- Formed with non-linear transformations
- Includes the self-squaring fractals and the
self-inversefractals
29Mandelbrot 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
30The Mandelbrot Set
31Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
32Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
33Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
34Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
35Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
36Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
37Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
38Zooming into the set
www.chem.vu.nl/feenstra/mandel_gallery.html
39Zooming into the Mandelbrot Set
Mandelbrot Zoom
Interactive Mandelbrot Zoom
40Computing 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)
AND iteration lt maxiteration ) y 2xy
y0 x x2 - y2 x0 x2 xx y2 yy
iteration iteration 1 if ( iteration
maxiteration ) color black else color
iteration
41Midpoint Displacement Technique
- Start with an initial object
- Find the midpoint of the edges of the object
- Randomly perturb those midpoints
- Repeat recursively
- 2D for coastlines
- 3D for mountains
42Midpoint Displacement
43Midpoint Displacement
44Midpoint Displacement
45Fractal Mountains
- Start with the basic shape of the mountain
- Subdivide edges of the shape
- Randomly perturb the new vertices
- Repeat recursively
46Fractal Terrain Results
47More Fractal Terrain
48www.cg.tuwien.ac.at
49www.nextrevision.com
50djconnel.com/Vue/
51Fractal Terrain
- Problems?
- Just doesnt look quite right
- Coloration
- Landscape ruggedness
- What else?
- Modifications to the basic technique
- Randomize all points, not just midpoints
- Vary roughness based on height
- User guided terrain generation
52Other Uses of Fractals
53Other Uses of Fractals
54Other Uses of Fractals
http//baddoggames.com/planet/gallery.htm
55Other Uses of Fractals