fractals and terrain synthesis
DESCRIPTION
Fractals and Terrain Synthesis. WALL-E, 2008]. Proceduralism. Philosophy of algorithmic content creation Frees up artist time to concentrate on most important elements (hero characters, major locations) Musgrave: "not one concession to the hated user". Simulation and Optimization. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/1.jpg)
Fractals and Terrain Synthesis
![Page 2: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/2.jpg)
WALL-E, 2008]
![Page 3: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/3.jpg)
Proceduralism
• Philosophy of algorithmic content creation• Frees up artist time to concentrate on
most important elements (hero characters, major locations)
• Musgrave: "not one concession to the hated user"
![Page 4: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/4.jpg)
Simulation and Optimization
• Simulation:– models through simulation of underlying
process– control through initial settings– may be difficult to adjust rules of simulation
• Optimization:– models through energy minimization– control through constraints, energy terms– may be difficult to design energy function
![Page 5: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/5.jpg)
![Page 6: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/6.jpg)
[Rusnell, Mould, and Eramian 2009]
![Page 7: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/7.jpg)
![Page 8: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/8.jpg)
![Page 9: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/9.jpg)
![Page 10: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/10.jpg)
![Page 11: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/11.jpg)
Height Fields
• Each point on xy-plane has a unique height value
• Convenient for graphics – simplifies representation (can store in 2D array)
• Used for terrain, water waves• Drawback: not able to represent full range
of possibilities
![Page 12: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/12.jpg)
![Page 13: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/13.jpg)
Height Fields and Texture
• Can use any texture synthesis process to generate height fields– simply interpret intensity as height, create
mesh, render• The most successful processes have used
fractals– self-similarity a feature of real terrains– self-similarity defining characteristic of fractals
![Page 14: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/14.jpg)
![Page 15: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/15.jpg)
Iterated Function Systems
• Show up frequently in graphics• L-systems replacement grammar a
celebrated example• Capable of producing commonly cited
fractal shapes– Sierpinski gasket– Menger sponge– Koch snowflake
![Page 16: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/16.jpg)
![Page 17: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/17.jpg)
![Page 18: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/18.jpg)
Mandelbrot Set
• Said to “encode the Julia sets”• coloring of the complex plane for
connectivity of quadratic Julia sets – say Jc is the set for zn+1 = zn
2 + c• Point c is in the Mandelbrot set if Jc is
connected, not in the set otherwise• Partitions complex plane
– “Mandelbrot separator” – fractal curve
![Page 19: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/19.jpg)
![Page 20: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/20.jpg)
Mandelbrot set calculation
• Turns out that it is quite straightforward to get the Mandelbrot set computationally:– for each pixel c:
• let z0 = c• compute z = z2+c repeatedly, until
– (a) |z| > 2 (diverges)– (b) iteration count exceeds constant (say 1000)
• if diverged, color it according to the iteration number on which it diverged
• if never diverged, color with some special color
![Page 21: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/21.jpg)
![Page 22: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/22.jpg)
Fractals
• Nonfractal complexity: arises from accretion of different kinds of detail– e.g., people: complex, but not self-similar
• Fractal complexity: arises from repeating the same details– What detail to repeat?– Perlin noise a suitable source of detail
![Page 23: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/23.jpg)
Multiresolution Noise
• Different signals at different scales• Fractals: clouds, mountains, coastlines
1/2 1/4 1/8 1/16 sum
![Page 24: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/24.jpg)
Multiresolution Noise
• FNoise(x,y,z) = sum((2^-i)*Noise(x*2^i…))
• Extremely common formulation – so common that many mistake it for the basic noise primitive
![Page 25: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/25.jpg)
Fractional Brownian Motion• aka fBm• requires parameter H (relative size of
successive octaves – "roughness")val = 0;for (i = 0; i < octaves; i++) { val += Noise(point)*pow(2,-H*i); point *= 2;}
![Page 26: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/26.jpg)
Fractional Brownian Motion• aka fBm• requires parameter H (relative size of
successive octaves – "roughness")val = 0;for (i = 0; i < octaves; i++) { val += Noise(point)*pow(2,-H*i); point *= 2;}
why 2?"Lacunarity" parameter
![Page 27: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/27.jpg)
Lacunarity
• "Lacunarity" (from Latin "lacuna", gap) gives the spacing between octaves
• Larger values mean fewer octaves needed to cover same range of scales– faster to compute– but individual octaves may be visible
• Smaller values mean more densely packed octaves, richer appearance
![Page 28: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/28.jpg)
Lacunarity• Balance between speed and quality• Value of 2 the "natural" choice
– but in genuinely self-similar fractals, may lead to visible artifacts as same features pile up
• Transcendental numbers good– genuinely irrational, no piling at any scale
• Values slightly over 2 offer good compromise of speed/appearance– e-1/2, π-1
![Page 29: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/29.jpg)
Fractal ranges of scale
• Real fractals are band-limited: they have detail only at certain scales
• Computed fractals also band-limited– practical limitations: don’t write code with
infinite loops• Mandelbrot: fractal objects have 3+ scales
![Page 30: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/30.jpg)
Midpoint Displacement
• Repeated subdivision:– begin with two endpoints; at each step, divide
each edge and perturb the midpoint– In 2D: on alternate steps, divide orthogonal
and diagonal edges• Among the first fractal terrain systems
(Fournier/Fussell/Carpenter 1982)• Problems: seams from early points
![Page 31: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/31.jpg)
Midpoint Displacement
![Page 32: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/32.jpg)
Midpoint Displacement
![Page 33: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/33.jpg)
Characteristics of fBm
• Homogeneous: the same everywhere• Isotropic: the same in all directions
• Real terrains are neither– mountains differ from plains– direction can matter (e.g., rivers flow downhill)
• Require multifractals
![Page 34: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/34.jpg)
Multifractals• Fractal dimension varies with location• Simple multifractal: multiplicative cascade
val = 1;for (i = 0; i < oct; i++){ val *= (Noise(point)+offset)*pow(2,-H*i)point *= 2; }
![Page 35: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/35.jpg)
![Page 36: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/36.jpg)
Problems
• Multiplicative formation unstable (can diverge)
• Extremely sensitive to value of offset• Control elusive
![Page 37: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/37.jpg)
Hybrid multifractals• In real terrains, higher areas are rougher
(new mountains) and lower areas smoother (worn down, silted over)
• Musgrave: weight of each octave multiplied by current value of function– near value=0 (“sea level”), higher frequencies
damped – very smooth– higher values: more jagged– need to clamp value to prevent divergence
![Page 38: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/38.jpg)
Ridges
• Simple trick to get ridges out of noise:– Noise values range from -1 to 1– Take 1-|N(p)|– Absolute value reflects noise about y=0;
negative moves reflections to top• Cellular texture (Voronoi regions) naturally
has ridges, if distance interpreted as height
![Page 39: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/39.jpg)
![Page 40: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/40.jpg)
![Page 41: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/41.jpg)
von Koch snowflake
![Page 42: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/42.jpg)
L-Systems
• "Lindenmeyer systems", after Aristid Lindenmeyer (1960's)
• Replacement grammar– set of tokens– rules for transformation of tokens
– All rules applied simultaneously across string
![Page 43: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/43.jpg)
L-Systems• Very successful for modeling certain
classes of structured organic objects– ferns– trees– seashells
• Success has impelled others to apply the methods more widely– rust– entire ecosystems
![Page 44: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/44.jpg)
L-System example
• Tokens: A, B• Rules
– A → B– B → AB
![Page 45: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/45.jpg)
L-System example
• Tokens: A, B• Rules
– A → B– B → AB
• Initial string: A• Sequence: A, B, AB, BAB, ABBAB…• Lengths are Fibonacci numbers (why?)
![Page 46: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/46.jpg)
Geometric Interpretation
• Strings are interesting, but application to graphics requires geometric interpretation
• Usual method: interpret individual tokens as geometric primitives
![Page 47: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/47.jpg)
Turtle Graphics• The language Logo (1967) – once widely
used for education• Turtle has heading and position; when it
moves, it draws a line behind it• Commands:
– F, B: move forward/backward fixed distance– +,- : turn right/left fixed angle– [, ] : push or pop the current state– A : no-op
![Page 48: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/48.jpg)
![Page 49: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/49.jpg)
![Page 50: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/50.jpg)
![Page 51: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/51.jpg)
L-Systems and the Turtle
• Example replacement rules for the turtle:– F → F-F++F-F– everything else unchanged
![Page 52: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/52.jpg)
von Koch snowflake
![Page 53: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/53.jpg)
Branching
• 'Push' and 'pop' operators can produce branching:– A → F[+A][-A]FA– F → FF
• A is an 'apex' – the tip of a branch• Each apex sprouts a new branch with
buds midway along its length, while existing branches elongate
![Page 54: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/54.jpg)
![Page 55: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/55.jpg)
Turtle Graphics in 3D
• Turtle has orientation and position• Commands:
– F, B: move forward/backward fixed distance– +,- : turn right/left fixed angle (yaw)– ^,& : turn up/down fixed angle (pitch)– \, / : roll right/left fixed angle– [, ] : push or pop the current state– A : no-op
![Page 56: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/56.jpg)
![Page 57: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/57.jpg)
Ternary Tree
• As usual, just one rule:
• F → F[&F][/&F][\&F]
• Each segment has three branches attached to its tip
![Page 58: Fractals and Terrain Synthesis](https://reader035.vdocuments.net/reader035/viewer/2022062301/5681621e550346895dd244a6/html5/thumbnails/58.jpg)