Simulating Biology: Growth, Ecosystems, and Predator-Prey
Lecture, Dr. Lawlor
An enormous number of biological systems are classified as
"reaction-diffusion" systems. The "reaction" part could be a
simple chemical reaction like oxidation during respiration, or a
more complex interaction like "plants uptake nitrogen from soil" or
"predators feed on prey". The "diffusion" part corresponds to
the local neighborhood averaging that happens in a variety of
Physics of Diffusion
A huge number of real things follow a diffusion law:
In each case, the physical process is driven by the interactions of
immediate neighbors, but the effects spread out across the entire
domain. Do keep in mind diffusion does not need to work
equally in all places or directions--real obstacles like glaciers or
mountains simply slow the diffusion rate, possibly to zero.
- Heat conduction in solids follows a diffusion law, where the
diffusion rate corresponds to the thermal conductivity.
This is due to the random kinetic interactions of the molecules
of the solid with their immediate neighbors. The net
result is heat
diffuses through uniform materials, with a small sharp hot
region blurring out into a large fuzzy warm zone.
diffuses through translucent materials like wax or milk,
whenever the scattering rate is high enough that the "mean free
path" of a photon is short.
- Between the cells in living tissue, most of the
millimeter-scale transport of nutrients, waste, or oxygen beyond
the capillary level happens via diffusion. Essentially all
transport inside a cell is via random brownian diffusion.
signals diffuse through growing tissue, directing the
growth of that same tissue. For example, the Gray
Scott equations represent this.
- Assuming animals move in random directions, the time average
of animal concentration will diffuse outward.
- Assuming random wind directions, the time average of pollen
transport follows a diffusion law, spreading from the source
plant out in all directions.
- Assuming you talk with friends about random topics, ideas
diffuse between people via a diffusion-type process: if most of
your friends have heard of BitCoin, eventually you probably will
The basic idea in diffusion, or blurring, is to get rid of the
high-spatial-frequency detail in an image; a "low-pass"
filter. See the
fourier transform discussion here for what I mean by high and
low frequencies (small and large details in an image).
The way blurring gets rid of small details is by averaging them with
nearby pixels--because nearby pixels will have the same overall low
frequency colors, but different high-frequency details, the details
get averaged away
but the low frequencies remain.
You can implement blurring in a 2D texture in many different ways:
One curious result of the central
(almost) any blurring technique results in a Gaussian blur when
repeatedly (same image blurred over and over again). This is
good, because it means we can just repeatedly
apply a cheap lumpy blur (with few taps) to get results similar to a
high-quality blur (with exponentially more taps).
- Change the mipmap LOD bias: texture2D(tex,coords,bias);.
make the mipmapping hardware include additional blurring by
artificially shifting mipmap levels, essentially sampling a
2^bias pixel region. Clearly, this only works if
you've built mipmaps for your texture, but THREE.js does this
- Draw a few copies of the image slightly shifted from one
carefully adjusting the alpha each time so the copies end up
weighted onscreen--surprisingly, the alpha values you need are
then 1.0/2, then 1.0/3, then 1.0/4, etc.
- Read a few nearby pixels ("filter taps") in a GLSL pixel
and average them together in a single shader pass. This is
little faster than the multipass rendering method, and it's
easier to write and
expand to do other processing, so it's what I usually do.
course, that doesn't mean it's the best!)
- Read a whole bunch of nearby pixels, and weight them by a
Gaussian curve to get Gaussian
This is the default blur performed by most image editing
although it's not totally clear why folks choose this.
Given both original and blurred images, you can subtract the two to
find just the image details (the high frequencies alone). This
useful for several interesting tasks, including HDR Tone Mapping.
You can even mix high and low frequencies from different images for a
Physics of Reaction
A variety of processes can result in a nonlinear interaction after
the diffusion step:
Generally speaking, you can get interesting behavior whenever you
blurring (which brings neighborhoods together) with almost *any*
nonlinear reaction (which drives neighbors farther apart).
- For ice solidification, the interesting physics is in the
interaction of the diffusing heat and freezing ice fields.
Both have thresholds that drive the growth of solid dendrites.
- Predator-prey interactions can, depending on the parameters,
reach either a steady state, oscillate, or diverge wildly.
The number of animals, even time averaged, cannot ever go
negative. This limits the population swings, but can lead
to localized extinction until new animals diffuse in from
outside. For example, ciccada emergence is almost always
delayed by a prime number of years, such as 13 or 17, to avoid
amplifying predator oscillations of any shorter period.
- Interactions between plant species, such as the ongoing local
battle between spruce and the aspen/birch/cottonwood alliance,
occur mostly at the level of soil chemistry (spruce acidifies
the soil; deciduous trees smother their competitors with leaves)
and wildfires (the secret weapon of the spruce).
- Reactions between chemical signals inside living tissue result
in the formation of differentiated tissue like bones and
muscles, the layered neurons in your cerebral cortex, the spots
on a tiger, or the stripes on a zebra.