1 / 21

Simulating Trees with Fractals and L-Systems

Simulating Trees with Fractals and L-Systems. Eric M. Upchurch CS 579. Background - Fractals. Fractals are recursive, self-similar structures Infinitely detailed – zooming in reveals more detail Similar, though not necessarily identical, at any level of magnification

vcendejas
Download Presentation

Simulating Trees with Fractals and L-Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simulating Trees with Fractals and L-Systems Eric M. Upchurch CS 579

  2. Background - Fractals • Fractals are recursive, self-similar structures • Infinitely detailed – zooming in reveals more detail • Similar, though not necessarily identical, at any level of magnification • Generated using a variety of methods, such as IFS and L-Systems • Many natural forms display fractal geometry (like trees!)

  3. Background – L-Systems • Formal grammar developed by Aristid Lindenmayer as a theoretical framework for studying development of simple multicellular organisms • Subsequently applied to investigate higher plants • Uses rewriting rules (productions) to grow a string or system • Productions are applied in parallel (unlike Chomsky grammars) • This is motivated by biological considerations – this is how living organisms grow

  4. Strings built of letters a and b Each letter is associated with a rewriting/production rule: a  ab b  a Rewriting starts from an axiom, a starting string (b in this case) Each production is applied simultaneously in each step Simple L-System

  5. L-Systems – Properties • Can be context-free or context-sensitive • Different production rules for the same symbol based upon neighboring symbols • If run repeatedly and interpreted as images, can produce fractal geometry • Can describe many “traditional” fractal patterns, such as Koch curves and constructions • Can describe & produce very complex fractal patterns

  6. Iterated Function Systems • An IFS is any system which recursively iterates a function or a collection of arbitrary functions on some base object • An IFS can be used to generate a fractal pattern • The IFS fractal is made up of the union of several copies of itself, each copy being transformed by a function • No restriction on transformations, though they are usually affine • Can use deterministic or stochastic processes

  7. Iterated Function Systems • If the system is made up by k functions (or transformations) {fi(x) | 1 < i < k} and iterated n times on the base set b, then the IFS is defined as the set: • { fi1(fi2 ( .. fik(b) .. )) | for all ij, with 1 < ij < k, j = (1, 2, .. , k) } • In the limit that n becomes infinite, an IFS becomes a fractal.

  8. Relationship of IFS to L-Systems • Both are recursive in nature • Both can be used to produce fractals • L-Systems are, arguably, a specialized form of IFS, whose functions are specified by the production rules of the grammar • Replace the formal grammar of an L-System with functions/transformations, and you have an IFS

  9. Describing Trees • A rooted tree has edges that are directed and labeled • Edge sequences form paths from a distinguished node, called the root or base, to terminal nodes • In biological sense, these edges are branch segments • A segment followed by at least one more segment in some path is called an internode • A terminal segment (with no succeeding edges) is called an apex

  10. Axial Trees • Special type of rooted tree • At each node, at most one outgoing straight segment is distinguished • All remaining edges are called lateral or side segments. • A sequence of segments is called an axis if: • the first segment in the sequence originates at the root of the tree or as a lateral segment at some node • each subsequent segment is a straight segment • the last segment is not followed by any straight segment in the tree. • Together with all its descendants, an axis constitutes a branch. A branch is itself an axial (sub)tree.

  11. Axes and branches are ordered The root axis (trunk) has order zero. Axis originating as a lateral segment of an n-order parent axis has order n+1. The order of a branch is equal to the order of its lowest-order or main axis Axial Trees

  12. Example Axial Tree

  13. Honda’s Model • Limited model with following assumptions: • Tree segments are straight and their girth is not considered • A mother segment produces two daughter segments through one branching process • Lengths of the two daughter segments are shortened by constant ratios, r1 and r2, with respect to the mother segment • Mother and daughter segments are contained in the same branch plane. The daughter segments form constant branching angles, a1 and a2, with respect to the mother branch • Branch plane is fixed with respect to the direction of gravity so as to be closest to a horizontal plane. An exception is made for branches attached to the main trunk, where a constant divergence angle αbetween consecutively issued lateral segments is maintained

  14. Honda’s Geometry

  15. Honda’s Trees

  16. My Tree Simulator • Written in C++, using the DirectDraw API • Draws 2D trees by writing to a bitmap • Does simple lighting and shading • Produces a fair mix of completely ugly trees and good looking/accurate trees • Uses stochastic IFS transformations, inspired from L-Systems and extends Honda’s work • Drawing infrastructure borrowed from a Julia Set generator

  17. My Tree Simulator • A tree is specified by: • Radius (thickness of trunk) • Height • Some number of branches, each having: • Scaling factor (all branches are scaled according to order) • Height/length of branch • Lean angle (from higher order branch) • Rotation angle (around higher order branch) • Number of branches is used in recursively creating branches

  18. My Tree Simulator • IFS is performed by transformations specified in each branch. • Transformations: scale, lean, rotation, are stochastically determined • Foliage is done using the same method but using different colors to give the illusion of leaves • Z-buffer utilized for determining which pixels are drawn

  19. My Tree Simulator • A tree contains several flags that define which IFS transformations are applied: • Use Branch Heights  If true, places branches randomly up trunk. If false, places all branches coming out of trunk (and recursive branches) at same point. • False tends to make trees more irregular. • Global Scaling  If true, scales branches and foliage based on a single scale (stored in the trunk branch). Otherwise, scales each branch separately based on a scale stored per branch. • True makes trees more regular, and “tighter”. • False makes trees more irregular, but can cause “puffiness”

  20. My Tree Simulator • Scale By Height  If true, branches and foliage decrease (more dramatically) as their height increases. • True keeps some trees from getting too “puffy”. • False makes trees more top-heavy, fuller, like elms. • True makes trees slimmer and decreasing, like a willow bush. • True will give a younger looking tree, false will give an older looking tree with the same structure.

  21. Future Work • Convert to 3D • 2D representation is easier, but very limiting • Allow model exportation for placement into virtual worlds • Use foliage models in 3D • More realistic effect, scales well, could provide physics-based modeling effects (wind, sway, etc) • Enhance parameterization of trees • Currently, everything is random!

More Related