Butterflies & Flowers (3D)

Watch how butterflies fly: wingbeats, lift, Strouhal number, the vortex wake and the colour of the scales. Click to plant flowers.

Switch to 2D

Presets

Playback

Butterfly body

Pick a species preset above, then change wing length, mass and wing area.

Flapping and flight

Frequency, stroke and air speed set the Strouhal number. Auto C_L lets the butterfly carry its weight; switch it off to choose C_L yourself.

Wing colour

Structural colour comes from thin chitin layers separated by air. The layer thicknesses decide which colour is reflected.

Meadow

More butterflies, more wandering. Click the meadow or the map to plant a flower.

Camera

Layers

Quality

Model checks

The science

What this model is

A butterfly flaps two pairs of wings through a large stroke at 5 to 20 beats per second. This page treats the wings as a quasi-steady aerodynamic surface: at each instant the lift comes from the air speed over the wing, which combines the flight speed and the flapping speed. Everything is computed in SI units; the picture is drawn at 1 unit = 3.5 cm and slowed down so you can see single wingbeats (the slow-motion slider).

1. Flapping kinematics

The wing angle above the body plane is phi(t) = phi0 + (Phi/2) sin(2 pi f t), with stroke amplitude Phi, frequency f and a stroke centre phi0 = 12 degrees. The flapping speed of the wing section at the radius of the second moment of area (r2 = 0.58 R) is u_f = r2 dphi/dt = r2 pi f Phi cos(2 pi f t), with Phi in radians. The peak-to-peak vertical travel of the wing tip is A = 2 R cos(phi0) sin(Phi/2).

2. Lift, weight and the lift coefficient

The instantaneous lift is L(t) = 1/2 rho C_L S (U^2 + u_f(t)^2), where U is the forward air speed, S the total wing area and rho the air density. Averaged over a wingbeat <u^2> = U^2 + r2^2 R^2 (pi f Phi)^2 / 2, so level flight needs C_L = m g / (1/2 rho S <u^2>) (the "C_L needed" readout and the fourth graph). The required value rises quickly when the butterfly slows down; in hover only the flapping speed is left. A fixed-wing section stalls near C_L = 1 to 1.5, but the leading-edge vortex on a flapping insect wing can reach about 2.5 (the red line, an assumption set to 2.6): beyond it the butterfly cannot hold height and the simulation lets it sink.

3. Vertical motion and body bobbing

The height follows m dv/dt = L(t) - m g - 1/2 rho C_D,b (S/2) v |v| (C_D,b = 1). Because L(t) peaks twice per beat, the body bobs up and down at twice the wingbeat frequency, as real butterflies do. With "Auto C_L" on, the butterfly sets its C_L to carry its weight; with the altitude pilot on it also climbs or descends to the flower it is visiting (a PD controller on height and vertical speed). Switch both off to fly with a fixed C_L and watch it climb or sink.

4. Strouhal number and the wake

St = f A / U compares the flapping tip speed with the forward speed. Swimming and flying animals that cruise efficiently cluster at 0.2 < St < 0.4 (Taylor, Nudds and Thomas 2003), the green band on the third graph. The wake is drawn as a train of vortex rings shed at each half-stroke, spaced about U / (2 f) apart in the air. The circulation estimate assumes one ring of radius R per wingbeat that carries the weight impulse, Gamma = m g / (rho pi R^2 f) (vortex-ring gait).

5. Power

The aerodynamic power is estimated as P = 1/2 rho C_D S <|u|^3> with C_D = 0.12 + C_L^2 / (pi e AR) (e = 0.7, aspect ratio AR = (2R)^2 / S), using a numerical average of u^3 over a beat. It ignores the inertial power needed to accelerate the wings and any elastic storage.

6. Colour: pigments and thin-film structures

The orange of a monarch comes from pigments that absorb short wavelengths. The blue of a Morpho wing has no blue pigment: the scales carry stacks of chitin lamellae (refractive index n1 = 1.56) separated by air (n2 = 1.0). Light reflected from every interface adds in phase when lambda = 2 (d1 sqrt(n1^2 - sin^2 theta) + d2 sqrt(n2^2 - sin^2 theta)) (Bragg condition), so the colour moves towards violet as the viewing angle theta grows. The reflectance graph is computed with the characteristic-matrix (transfer-matrix) method, s and p polarisation averaged; the spectrum is turned into a screen colour with a CIE 1931 colour-matching fit under a flat white illuminant.

7. Steering between flowers

Butterflies wander, seek the nearest flower with nectar, slow down to arrive, land, feed for 2 to 5 s and move on. A visit that follows a visit to another flower of the same kind counts as a cross-pollination event. Click the meadow (or the map) to plant a flower.

Model checks on this page

(1) the cycle average of the instantaneous lift by quadrature against the closed form, and trimmed lift against weight; (2) the Strouhal number measured from the simulated tip path against the formula; (3) the transfer-matrix reflectance peak against the Bragg condition; (4) a step-size test of the vertical-motion integrator.

Honest simplifications

  • Quasi-steady aerodynamics with a constant C_L: it ignores clap-and-fling, wake capture, added mass, wing flexibility and the unsteady build-up of the leading-edge vortex. C_L max is an assumption, not a measurement of a particular species.
  • Forward speed is a controlled input (scaled down near flowers); the horizontal thrust balance and body pitch are not solved. The pitch and wing twist drawn on screen are cosmetic.
  • Species numbers (wing length, mass, area, frequency) are of the right order of magnitude, not measurements of individual animals. The efficient Strouhal band is an empirical range, not a prediction for a given wing.
  • The live viewing angle is halved before it enters the Bragg formula, a crude stand-in for the angle-spreading of ridged scales (otherwise the wing would fade to white at steep angles). The structural colour treats the stack as flat parallel layers; real Morpho scales have ridged lamellae that spread the reflection over a wide angle and a pigment layer below that absorbs transmitted light. Monarch and white-butterfly colours use simple illustrative spectra.
  • Vortex rings are a visual aid placed from the flapping phase, not the output of a flow solver; ring sizes and decay are schematic.

What to try

  • Press Slow and hovering: U drops to 0.4 m/s, C_L needed jumps above the red line and the butterfly can no longer hold its height.
  • Press Strouhal sweet spot: U is set so that St = 0.3, the middle of the efficient band.
  • Press Blue morpho, choose the Follow close camera and orbit around it: the wing colour moves from blue towards violet as the viewing angle grows. Change the air gap d2 to retune the colour.
  • Switch off Auto C_L and lower C_L: the butterfly sinks until it reaches the ground.
  • Raise the flap frequency while keeping U fixed and watch St, the lift ripple and the body bobbing change.
  • Click the meadow to plant a flower and see which butterfly arrives first. Click a butterfly to follow it.
Loading model...
Loading Blender model...
Wing angle during the last wingbeats
Lift divided by weight (body bobbing)
Strouhal number against forward speed
Lift coefficient needed for level flight
Wing reflectance spectrum and colour
Meadow map (click to plant a flower)
Made with ๐ŸŸ  Blender ยท Three.js

๐Ÿฆ‹ Butterflies & Flowers

Colourful butterflies flutter between flowers using natural steering behaviour. Each butterfly independently seeks nectar, avoids others and performs a gentle, realistic wing-beating flight pattern.

๐Ÿ”ฌ What It Demonstrates

Steering behaviours โ€” seek, arrive and wander โ€” combined with a procedural wing animation. Each butterfly navigates independently using local perception.

๐ŸŽฎ How to Use

Click anywhere to plant new flowers and watch butterflies discover them. Observe how they approach, feed and move on to the next flower.

๐Ÿ’ก Did You Know?

Real butterflies can see ultraviolet light, which reveals hidden patterns on flowers called "nectar guides" โ€” runway lights pointing to the pollen.

About Butterflies & Flowers Simulation

This simulation models butterfly foraging behaviour using autonomous steering agents. Each butterfly independently applies seek, arrive, and wander steering forces to locate flowers, approach them, feed briefly, then move on โ€” closely mirroring how real butterflies navigate a garden. The wing-beat animation is procedurally driven by a sinusoidal function, producing a lifelike flapping rhythm.

Steering behaviours were popularised by Craig Reynolds in 1987 and underpin modern game AI, robotics path planning, and crowd simulation. Butterfly pollination itself is critical to roughly one-third of global food crops, making it one of the most economically important ecological interactions studied today.

Frequently Asked Questions

What is steering behaviour and why do the butterflies move the way they do?

Steering behaviour is an algorithmic technique where each agent computes a desired velocity toward a goal and smoothly corrects its current velocity to match. In this simulation every butterfly independently calculates a force pointing toward its chosen flower, blended with a "wander" wobble force that prevents straight-line flight. The result is the organic, slightly erratic path real butterflies take in nature.

How do I interact with the simulation?

Click anywhere on the canvas to plant a new flower at that spot โ€” a nearby butterfly will immediately redirect toward it. Use the Butterflies slider to add up to 40 individuals and the Speed slider to slow down or accelerate the scene. The Spring Burst button scatters 10 new flowers at once, while Clear Flowers resets to the original 8 blooms.

Why do butterflies pause on flowers before flying off?

When a butterfly closes within 20 pixels of its target flower it enters a "resting" state lasting 1.5 to 4.5 seconds โ€” modelling the time a real butterfly spends drinking nectar with its proboscis. Once the rest timer expires the butterfly selects a new random flower and resumes flight. You can observe the slower wing-beat during this resting phase, which also matches real butterfly behaviour.

What mathematics drives the wing-beat animation?

The wing opening is computed as the absolute value of a sine function applied to a continuously incrementing angle: wingOpen = |sin(wingAngle)|. This produces a value that oscillates smoothly between 0 (wings closed) and 1 (wings fully spread) without ever going negative, giving a natural flapping appearance. The wing angle increments at a rate of 0.12 to 0.22 radians per frame, scaled by the global speed multiplier, so faster speed settings also produce a faster flap rate.

How do real butterflies find flowers in the wild?

Real butterflies rely primarily on colour vision that extends into the ultraviolet spectrum, allowing them to detect nectar guide patterns on petals that are invisible to humans. They also use olfactory cues โ€” detecting floral volatile compounds from distances of several metres โ€” and landmark memory to revisit productive patches. Monarch butterflies additionally use a time-compensated sun compass to navigate migration routes spanning 4,500 kilometres from Canada to central Mexico.

Is it true that butterflies taste with their feet?

Yes โ€” this is a well-documented fact, not a myth. Butterflies possess chemoreceptors called contact chemosensilla on their tarsi (feet). When a butterfly lands on a leaf or flower these sensors detect sugars, salts, and plant compounds almost instantly, allowing it to decide within milliseconds whether to feed or lay eggs. This is why you will often see a butterfly "stamp" on a surface immediately after landing.

Who first described steering behaviours for computer animation?

Craig Reynolds introduced the concept in his landmark 1987 SIGGRAPH paper "Flocks, Herds and Schools: A Distributed Behavioral Model," which demonstrated that complex group movement emerges from three simple local rules โ€” separation, alignment, and cohesion. He later formalised individual steering behaviours including seek, flee, arrive, pursue, and wander in a 1999 paper. Reynolds received a Scientific and Engineering Academy Award in 1998 for this work's impact on visual effects.

What other simulations are closely related to this one?

The Migrating Bird Flock simulation on this site uses the same family of steering behaviours but adds the three flocking rules (separation, alignment, cohesion) so birds move as a coordinated group rather than independently. Ant colony and bee swarm simulations extend the model with pheromone trails or waggle-dance communication. Crowd evacuation simulations used in stadium and building design rely on the same arrive and separation forces scaled to thousands of pedestrian agents.

How is butterfly-inspired movement used in robotics and engineering?

Micro air vehicle (MAV) researchers study butterfly wing kinematics to design flapping-wing drones that are more efficient at low speeds than fixed-wing aircraft. The unsteady aerodynamic effects โ€” leading-edge vortices shed by the flexible wing โ€” generate lift coefficients far above what steady-state aerodynamic theory predicts. Companies such as Festo have built demonstration robots (BionicFlyingFox, eMotionButterflies) that use on-board infrared tracking to replicate the same seek-and-avoid steering logic shown in this simulation.

What are the current open research questions about butterfly flight?

Active research areas include understanding how butterflies exploit "wake capture" โ€” recycling energy from their own previous wing stroke โ€” to minimise metabolic cost, and how the flexible, scaled wing surface dynamically deforms for passive aerodynamic stability. A 2020 study in Nature Physics showed that butterfly wings clap together and trap air in a cupped shape that catapults them forward far more efficiently than a rigid surface; the full fluid-structure interaction is still being modelled with high-resolution CFD. Neurological studies are also mapping how the tiny butterfly brain integrates polarised light, time-of-day, and magnetic field cues for long-distance navigation.