3 Dimensional Tree Generating Algorithms Ryan Pierce & Marco

advertisement
3 Dimensional Tree Generating Algorithms
Ryan Pierce & Marco Rathjen
University of North Carolina at Wilmington
Abstract
This paper shows different algorithms to
model 3 dimensional trees procedurally. We set
out to explore various existing methods in order
to better understand how some of these systems
are generated and to be able to apply them to
our future ventures in the fields of digital design
and 3 dimensional modeling.
We will
concentrate more on pre-rendered modeling
solutions, as opposed to those that are rendered
real time in some gaming models. The emphasis
lies on generating realistic looking trees, and
not on modeling growth behavior and actual
biological processes. We will explain how Lsystems, space colonization, and laplacian
growth models grow realistic looking trees.
Key Words: L-system, laplacian growth, space
colonization, dialectric breakdown model,
procedural modeling, generative art
1. Introduction
Since the 1960s scientist tried to model
plant growth behavior. Aristid Lindemeyer, a
theoretical biologist and botanist, developed
what is known today as the L-system. Lsystems are string rewriting systems that model
lower cell and plant topology. They are
generally used to model more complex
biological systems such as bacterial and algae
growth and the expansive growth of flora. Later
its usage became more sophisticated as more
modern
computational
methods
and
technologies became available.
Even most of the current models make
extensive use of L-system methodology.
Besides variations of L-systems there are newer
approaches like particle systems or space
colonization algorithms, which will be
discussed in this paper. We explain how Lsystems generate realistic plants with relatively
few rules, illustrate the space colonization
approach, and the dialectric breakdown model
as well as the laplacian growth model. We then
describe our implementation of a basic L-system
in the Processing 2 environment, and end with a
discussion what makes this paper a 300 level
worthy.
2. Plant growth models
In 1960 Aristid Lindenmayer developed
the Lindenmayer-system (L-system) to model
the relations between cells in what is called
plant topology. An L-system rewrites a string by
recursively replacing letters according to the
production rules it is given. Typically L-systems
are defined as a tuple:
G = (V, ω, P)
where V is the alphabet, little omega the
start state, and P are the production rules.
A classic example of this is the basic
modeling of the growth of algae, using A and B
as the alphabet. From there, growth of the
string follows the following rules: A derives
AB, B derives A and the axiom (initial
condition) would be A. This small set of
conditions and rules would produce the
following string (whereas n denotes the
generation):
n=0:A
n = 1 : AB
n = 2 : ABA
n = 3 : ABAAB
n = 4 : ABAABABA
n = 5 : ABAABABAABAAB
Unlike Chomsky grammars it is of note
that L-systems replace letters parallel. The
above L-system is called a DOL-system which
means it is deterministic and context free
(neighboring symbols have no effect on each
other)
3. Turtle graphics
To visualize these relations either as 2D
or 3D models these strings are “fed” into a
turtle. A turtle is a cursor that interprets the
string as “paint” instructions. The turtle has a
position and an orientation. Also, to generate
branching structures most strings contain
instructions as to when to push a positon onto a
LIFO stack and when to pop the position. This
technique of interpreting combination of strings
as line segments can be adopted to 3D by
allowing the turtle to move in 3D space and
using a rotation matrix and vectors.[PL page 19]
.
and everything else is the same as in the basic
L-system tuple.
๐‘ฎ๐… = (๐‘‰, ๐œ”, ๐‘ƒ, ๐œ‹)
๐œ”: ๐น
.33
๐‘1 : ๐น → ๐น[+๐น]๐น[−๐น]๐น
.33
๐‘2 : ๐น → ๐น[+๐น]๐น
.34
๐‘3 : ๐น → ๐น[−๐น]๐น
Example from [PL]
4. Space Colonization
Another technique to simulate visually
appealing and realistic trees is the space
colonization algorithm by Runions et al. which
adapts their algorithm for venation patterns in
leaves. [RFL]
Runions et al. randomly generate attraction
points within the area of a leaf; these attraction
points simulate the plant hormone auxin.
Starting out with a set of initial nodes,
attraction points closest to a node generate
vectors from the node to the attraction point.
The normalized sum of all the vectors from all
the nodes within the area of influence creates a
new node branching out from the mid-node
towards the attraction point. Then “extraneous”
attraction points within the area of influence get
removed.
3.1 Stochastic L-system
4.1 Space Colonization 3D
To prevent creating the exact same plant
randomness can be introduced by using what is
called a stochastic L-system. The turtle
interpretation and the production rules can be
varied, but Prusinkiewicz and Lindenmayer
state that varying the turtle interpretation does
not change the plant topology and therefore still
produce fairly uniform plants.
The quadruplet describes the stochastic Lsystem in which π is the probability distribution
This algorithm for venation pattern adapted to
a 3D volume by Runions et al. [RLP] generates
very convincing images of mature trees.
Manipulating the shape of the curve that is
rotated around the stem axis allows for variation
in crown geometry. In addition, by altering the
placement and number of the attraction points,
as well as the kill-distance for the attraction
points enables great control over the appearance
of the tree.[RFL] Furthermore, altering the
radius of influence has impact on the curvature
of the branches, smaller radii generate very
twisted branching.
Runions et al. algorithm, however, uses the
space colonization method only for generating
tree/ branch skeletons, and turn to L-systems to
complete the tree simulations.
5 Dielectric Breakdown Model
The dielectric breakdown model is
similar to Space Colonization in that it also
intends to replicate natural elements to generate
realistic branching structures. However, as the
name suggests, it is intended to replicate and
simulate the branching that occurs during
electrical discharge.
This simulation of
breakdown can be broken into three basic steps.
First, the electric potential on a grid is
calculated according to a pre-defined boundary
condition. Typically, the boundary conditions
are defined as a positive potential surrounding a
negative potential, with a positive starting point.
The second step, similar to the space
colonization model, involves selecting a growth
site, but based on the potential energy
calculation instead of the simulated hormone.
The growth site is selected using a weighted
probability function that will not be fully
described here, but is based on the summation
of all potentials at all points emitting from the
potential growth sites. These potential growth
sites include every directly adjacent cell, which
would be a maximum of six in three
dimensions. In the final step, the chosen growth
site is then added to the boundary conditions,
and the new potential is calculated across the
board. [Kim et al.]
These steps are carried out in an iterative
form until the desired aggregate is obtained.
6. Laplacian Growth
Laplacian instability is a natural
phenomenon that can be found in many natural
occurrences including electric potential,
snowflake growth, and lightning strikes. Since
it can be used to define a wide variety of things
that occur in nature, the simulation of this
instability can be implemented as an algorithm
that helps model many natural things including,
in our case, three dimensional trees. Laplacian
growth algorithms actually include such systems
as the dielectric breakdown model, but our
research has presented an implementation that is
much faster and uses less memory. This
implementation is simply known as "Fast
Simulation of Laplacian Growth." [ Kim et al]
In the dielectric breakdown model, the
interior of the system is defined as a perfect
conductor. This means that every cell needs to
be calculated at every step.
In the fast
simulation model, the interior of the system is
treated as a perfect insulator. This means that
only the points adjacent to the growth need to be
calculated at each step, significantly reducing
the time required by the first step. Kim et al.
have found that even under this different
system, the Laplacian growths still occur.
At best, the first step of the dielectric
breakdown model containing G cells, growing
an aggregate of size n takes O(n x G^1.5) time. [
Kim et al.] Since the grid can be very large
(especially in three dimensions) this is not a
wonderful solution. The fast simulation uses a
single point charge at the center of a ring of
charge, and the system is broken into a grid
where h is the physical length of a cell. Based
on this, the radius of the charge at the center can
be denoted as R1 = h/2 and the ring of charge is
R2 = N*h/2, where NxNxN is the size of the grid.
These variables are substituted into the three
dimensional Laplace equation. This is then
solved for ฯ• which represents charge. Since
perfect rings of charge do not exist in nature, R2
is taken to infinity, leaving the function:
ฯ• = 1 - R1/r
where r is the distance from a grid cell and its
point charge. The total potential of the system
can then be easily described by a summation of
all point charges within the system, given by the
formula:
References
ฯ•i = Σj=0to n(1 - R1/ri,j)
where j is the index of the charge, ri,j is the
distance between the grid cell i and the point
charge j and n is the total number of point
charges in the system. [Kim et al.]
The algorithm then proceeds in the same
manner as previously described in the dielectric
breakdown model, but the overhead from the
first step is severely reduced, leading to a much
more manageable estimated runtime of O(n2).
Please note that these runtimes simply represent
the time needed to calculate the structures, and
do not represent any rendering times.
Additional simulation techniques can be
easily incorporated into this algorithm,
including global simulations of light and wind.
Extra charges can be added throughout to stunt
or encourage growth as well.
7. Why 380 work ?
Analyzing the algorithm design for
generating 3D trees allows using a lot of the
knowledge from upper level classes like Formal
Languages and “Game Design.” Especially
knowledge of formal grammars, context free
grammars and Chomsky grammars. It also helps
to better understand gaming and modeling
concepts that will be used in future and present
400-level courses, as well as graduate school
and future careers.
[PRB] PATRICK O., REGE M., BAILEY R.,
Extending Space Colonization Tree
Modeling for Artistic Control and
Environmental Interactions.
[WKS] WOJCIECH
PALUBICKI,
KIPP
HOREL, STEVEN LONGAY, ADAM
RUNIONS,
BRENDAN
LANE,
RADOMÍR
MฤšCH,
AND
PRZEMYSLAW
PRUSINKIEWICZ.
2009. Self-organizing tree models for
image synthesis. In ACM SIGGRAPH
2009 papers (SIGGRAPH '09), Hugues
Hoppe (Ed.). ACM, New York, NY,
USA, , Article 58 , 10 pages.
[RFL] RUNIONS A., FUHRER M., LANE B.,
FEDERLP., ROLLAND-LAGAN A.-G.,
PRUSINKIEWICZ P.: Modeling and
visualization of leaf venation patterns.
ACM Transactions on Graphics 24, 3
(2005), 702–711.
[PL] PRUSINKIEWICZ P., LINDENMAYER
A.: The Algorithmic Beauty of Plants
2004.
[KSA] KIM T., SEWALL J., SUD A., LIN M.:
Fast Simulation of Laplacian Growth.
Computer Graphics and Applications,
IEEE 27, 2 (2007)
[RLP] RUNIONS A., LANE B.,
PRUSINKIEWICZ P.: Modeling Trees
with Space Colonization Algorithm.
Eurographics Workshop on Natural
Phenomena (2007)
Download