Download presentation
Presentation is loading. Please wait.
Published byCameron Rich Modified over 9 years ago
1
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April 2008 William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://snipurl.com/1y5gchttp://snipurl.com/1y5gc Course web site: http://www.kddresearch.org/Courses/CIS636http://www.kddresearch.org/Courses/CIS636 Instructor home page: http://www.cis.ksu.edu/~bhsuhttp://www.cis.ksu.edu/~bhsu Readings: Handouts from Barnsley Intro to Fractals and L-Systems
2
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Computer Graphics 11: 3D Object Representations – Octrees & Fractals Course Website: http://www.comp.dit.ie/bmacnameehttp://www.comp.dit.ie/bmacnamee
3
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractals All of the modelling techniques covered so far use Euclidean geometry methods Objects were described using equations This is fine for manufactured objects But what about natural objects that have irregular or fragmented features? Mountains, clouds, coral… “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.” Benoit Mandelbrot
4
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractal Geometry Methods & Procedural Modelling Natural objects can be realistically described using fractal geometry methods Fractal methods use procedures rather than equations to model objects - procedural modelling The major characteristic of any procedural model is that the model is not based on data, but rather on the implementation of a procedure following a particular set of rules Modelling On The Fly!
5
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractals A fractal object has two basic characteristics: Infinite detail at every point A certain self similarity between object parts and the overall features of the object The Koch Curve Mandelbrot Set Video From: http://www.fractal-animation.net/ufvp.htm http://www.fractal-animation.net/ufvp.htm
6
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Generating Fractals A fractal object is generated by repeatedly applying a specified transform function to points in a region of space If P 0 = ( x 0, y 0, z 0 ) is a selected initial position, each iteration of a transformation function F generates successive levels of detail with the calculations: In general the transformation is applied to a specified point set, or to a set of primitives (e.g. lines, curves, surfaces)
7
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Generating Fractals (cont…) Although fractal objects, by definition have infinite detail, we only apply the transformation a finite number of times Obviously objects we display have finite dimension – they fit on a page or a screen A procedural representation approaches a true representation as we increase the number of iterations The amount of detail is limited by the resolution of the display device, but we can always zoom in for further detail
8
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Example: The Koch Snowflake Images taken from Hearn & Baker, “Computer Graphics with OpenGL” (2004)
9
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Example: Ferns Very similar techniques can be used to generate vegetation
10
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractal Dimension The amount of variation in the structure of a fractal object is described as the fractal dimension, D More jagged looking objects have larger fractal dimensions Calculating the fractal dimension can be difficult, especially for particularly complex fractals We won’t look at the details of these calculations
11
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Types Of Fractals Fractals can be classified into three groups Self similar fractals These have parts that are scaled down versions of the entire object Commonly used to model trees, shrubs etc Self affine fractals Have parts that are formed with different scaling parameters in each dimension Typically used for terrain, water and clouds Invariant fractal sets Fractals formed with non-linear transformations Mandelbrot set, Julia set – generally not so useful
12
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Random Midpoint Displacement Methods For Topography One of the most successful uses of fractal techniques in graphics is the generation of landscapes One efficient method for doing this is random midpoint displacement
13
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Random Midpoint Displacement Methods For Topography (cont…) Easy to do in two dimensions Easily expanded to three dimensions to generate terrain Can introduce a roughness factor H to control terrain appearance Control surfaces can be used to start with a general terrain shape Terrain generation demo: http://world.std.com/~bgw/applets/1.02/MtFractal/MtFractal.html
14
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractals In Film Special Effects
15
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007 Lecture 9 – March 26, 2007
16
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractals The term fractal was coined in 1975 by Benoît Mandelbrot, from the Latin fractus, meaning "broken" or "fractured". (colloquial) a shape that is recursively constructed or self-similar, that is, a shape that appears similar at all scales of magnification. (mathematics) a geometric object that has a Hausdorff dimension greater than its topological dimension.
17
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Mandelbrot Set Mandelbrotset, rendered with Evercat's program.Evercat
18
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Mandelbrot Set
19
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics What is the Mandelbrot Set? We start with a quadratic function on the complex numbers. The Mandelbrot Set is the set of complex c such that
20
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Example
21
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics (Filled-in) Julia Sets The Julia Set of f c is the set of points with 'chaotic' behavior under iteration. The filled-in Julia set (or Prisoner Set), is the set of all z whos orbits do not tend towards infinity. The "normal" Julia set is the boundary of the filled-in Julia set. c = – 1c = –.5 +.5ic = – 5 +.5i
22
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Julia Sets and the Mandelbrot Set Some Julia sets are connected others are not. The Mandelbrot set is the set of c for which the Julia set of f c (z) = z 2 + c is connected. Map of 121 Julia sets in position over the Mandelbrot set (wikipedia)
23
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics A fractal is formed when pulling apart two glue-covered acrylic sheets.
24
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Fractal Form of a Romanesco Broccoli photo by Jon Sullivan
25
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Time for a Break
26
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics L-Systems An L-system or Lindenmayer system, after Aristid Lindenmayer (1925– 1989), is a formal grammar (a set of rules and symbols) most famously used to model the growth processes of plant development, though able to model the morphology of a variety of organisms.L-system or Lindenmayer system L-systems can also be used to generate self-similar fractals such as iterated function systems.
27
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics L-System References Przemyslaw Prusinkiewicz & Aristid Lindenmayer, “The Algorithmic Beauty of Plants,” Springer, 1996. http://en.wikipedia.org/wiki/L-System
28
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics L-System Grammar G = {V, S, ω, P}, where V (the alphabet) is a set of variables S is a set of constant symbols ω (start, axiom or initiator) is a string of symbols from V defining the initial state of the system P is a set of rules or productions defining the way variables can be replaced with combinations of constants and other variables. A production consists of two strings - the predecessor and the successor.
29
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics L-System Examples Koch curve (from wikipedia) A variant which uses only right-angles. variables : F constants : + − start : F rules : (F → F+F−F−F+F) Here, F means "draw forward", + means "turn left 90°", and - means "turn right 90°" (see turtle graphics).turtle graphics
30
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Turtle Graphics class Turtle { double angle;// direction of turtle motion in degrees double X;// current x position double Y;// current y position double step;// step size of turtle motion boolean pen;// true if the pen is down public void forward(Graphics g) // moves turtle forward distance step in direction angle public void turn(double ang) // sets angle = angle + ang; public void penDown(), public void penUp() // set pen to true or false }
31
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics My L-System Data Files Koch Triangle Form// title 4// number of levels to iterate 90// angle to turn F// starting shape F:F+F-F-F+F// a rule F F+F-F-F+F F+F-F-F+F+F+F-F-F+F-F+F-F-F+F- F+F-F-F+F+F+F-F-F+F Go to Eclipse
32
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics More Variables Dragon When drawing, treat L and R just like F. 10 90 L L:L+R+ R:-L-R LL+R+L+R+ + -L-R + L+R+ + -L-R + + - L+R+ - -L-R +
33
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics A Different Angle Sierpinski Gasket 6 60 R L:R+L+R R:L-R-L R L-R-L R+L+R- L-R-L -R+L+R
34
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Moving with Pen Up Islands and Lakes 2 90 F+F+F+F F:F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF f:ffffff// f means move forward with the pen up F+F+F+F next slide F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF
35
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Islands and Lakes One Side of the Box F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF
36
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics FF-[-F+F+F]+[+F-F-F] Using a Stack to Make Trees Tree1 [ push the turtle state onto the stack 4 ] pop the turtle state from the stack 22.5 F F:FF-[-F+F+F]+[+F-F-F] and I add leaves here
37
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Stochastic L-Systems http://algorithmicbotany.org/lstudio/CPFGman.pdf http://algorithmicbotany.org/lstudio/CPFGman.pdf seed: 2454 // different seeds for different trees derivation length: 3 axiom: F F--> F[+F]F[-F]F : 1/3 F--> F[+F]F : 1/3 F--> F[-F]F : 1/3
38
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics 3D Turtle Rotations Heading, Left, or, Up vector tell turtle direction. +(θ) Turn left by angle θ◦ around the U axis. −(θ) Turn right by angle θ◦ around the U axis. &(θ) Pitch down by angle θ◦ around the L axis. ∧ (θ) Pitch up by angle θ◦ around the L axis. \(θ) Rollleftbyangleθ◦ around the H axis. /(θ) Roll right by angle θ◦ around the H axis. | Turn around 180◦ around the U axis. @v Roll the turtle around the H axis so that H and U lie in a common vertical plane with U closest to up.
39
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics A Mint http://algorithmicbotany.org/papers/ http://algorithmicbotany.org/papers/ A model of a member of the mint family that exhibits a basipetal flowering sequence.
40
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Myles Akeem Singleton Central Illinois Chapter National BDPA Technology Conference 2006 Los-Angeles, CA Examining the World of Fractals
41
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Content of presentation Introduction to fractals L-systems/Production rules Plant images Turtle geometry Conclusion
42
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Introduction to fractals Fractal Geometric Self-similar Has fractional dimension Categorized under chaos science - fractal geometry 1975 - Benoît Mandelbrot defined the term fractal from the Latin fractus, “broken” or “fractured”
43
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Example of self-similarity
44
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Koch Snowflake iterations
45
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Julia set graphic
46
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Introduction to L-systems Fibonacci Thu-Morse Paperfolding Dragon curve Turtle graphics Branching Bracketed Several biological forms are branched, fragmented, or cellular in appearance and growth Example where a trunk emerges from a branch:
47
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Production rules 1968 - biologist Aristid Lindenmayer invents the L-system formula Used as a grammar to model the growth pattern of a type of algae Set of production rules: Rule 1: a → ab Rule 2: b → a
48
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Deterministic, context-free Lindenmayer system (D0L system) Rule 1: a → ab Rule 2: b → a b → a a → ab ab → aba aba → abaab abaab → abaababa
49
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Ben Hesper and Pauline Hogeweg Two of Lindenmayer’s graduate students Tested to see if L - systems could resemble botanic forms Images controlled by special characters would draw an image onto a screen F→move forward one, drawing f→move forward one, without drawing +→rotate clockwise by a given angle -→rotate counterclockwise by a given angle [→push into stack ]→pop from stack
50
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Koch Island example “F → F + F - F - FF + F + F - F” F→move forward one, drawing +→rotate clockwise by a given angle -→rotate counterclockwise by a given angle
51
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Plant images Adding a cursor stack system branching is gained Allows for the creation of plant- like images Mimics the structure of trees, bushes and ferns
52
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Push/pop operations at work Angle 45 Axiom F F = F [ + F ] F
53
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Variables, constants, start words, and rules Variables - symbols denoting replaceable elements Constants - symbols denoting fixed elements Start words - define how the system begins Rules - define how to replace variables with other variables or constants
54
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Turtle geometry Form of Logo programming Created 1967 at BBN, a Cambridge research firm, by Wally Feurzeig and Seymour Papert Grammar: nF - “n” steps forward nB - “n” steps back aR - turn a degrees right aL - turn a degrees left Constants = {nF, nB, aR, aL, Stop} Variables = {,,,...} Start = (none)
55
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Turtle path example → 5F 90R → 5f → 5F 90R → 5F STOP Production rules: F→ move forward, drawing F→ move forward, without drawing nF→ “n” steps forward nB→ “n” steps back aR→ turn “a” degrees right aL→ turn “a” degrees left denotes the part of the turtle's trail that is not specified Moves are represented by the transactions Turtle graphic generated
56
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Conclusion Fractal uses Model many different objects and shapes Scientific modeling Creating graphic designs for clothes Multimedia 3-D artwork Music pioneers of this research are learning how to apply the application of fractals to create new styles of music Uses a recursive process Algorithm is applied multiple times to process its previous output Provides very abstract musical results Becoming one of the most exciting fields of new music research The limits of fractal will continue to stretch
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.