loading...
running...
How to use
Fire a shell: press F or the Fire button. In the 2D view you can also click the sky: the engine solves the launch lean so the apex lies above the click, including wind drift.
Design a shell: pick the calibre (the size of the mortar), the burst pattern, and two colours. The first colour is the main salt; the second one is used by colour-change, ring and core patterns.
Try these:
- Choose Hot flame washes blue out: the copper-chloride band disappears above about 1400 K, and the incandescent continuum turns the star white-orange.
- Choose Moon (no air) and watch every star fly a perfect parabola; on Earth the quadratic drag bends the same burst into a soft sphere.
- Set the fuse error to -1.2 s: the shell breaks below its apex and the burst is lopsided, with more energy thrown upward.
- Add 12 m/s of wind: the whole burst drifts, and the tails shear because the wind grows with altitude.
- Turn on sound: the bang arrives after distance / speed of sound, about 3 s per kilometre, so the flash and the thump are decoupled.
Drag to orbit, wheel to zoom, the camera buttons jump to presets. Keys: F fire, Space pause, R reset. Slow motion (time scale) is in the Show section.
The night harbour scene (a launch barge with named mortar tubes, a pier, an island with a lighthouse and a lit low-rise old town with a cathedral, clock-style tower and spire) was modelled and baked in Blender with procedural window, stone, wood and foliage textures; Three.js r160 renders the particles, water and reflections on top and animates the beacons and the lighthouse lantern.
The science
Shell flight. A shell is a body with mass m, cross-section A and drag coefficient Cd. Its motion obeys
m dv/dt = -m g - 1/2 ρ(y) Cd A |v - w| (v - w)
with air density falling exponentially, ρ(y) = ρ0 exp(-y/H), scale height H = Rs T / g (about 8.4 km on Earth) and a wind w that grows with height. The ballistic coefficient kb = CdA/2m is why a 12 inch shell (large, heavy) loses less speed than a 3 inch one. The engine advances every body with an exact solution of the drag-only step, |u| → |u|/(1 + k|u|Δt), sandwiched between two half kicks of gravity, so it is second-order accurate and stable at any frame rate.
Closed forms used as tests. With constant density the vertical rise has hapex = ln(1 + k v02/g) / (2k) and tapex = atan(v0√(k/g)) / √(g k) with k = ρ kb; in vacuum the range is v02 sin 2θ / g. A separate RK4 integrator checks the full atmosphere. With no gravity a star under pure drag reaches R(t) = ln(1 + k v0 t)/k, which is the "ideal drag law" curve in the radius graph.
The burst. At the fuse time (normally the apex, where the shell moves slowest and the pattern looks symmetric) the shell shatters into stars. Each star is a small pressed pellet of diameter d, density about 1700 kg/m3, so its ballistic coefficient is kb = 0.6/(ρs d) (Cd = 0.8). It keeps the shell velocity plus a radial burst velocity vb. The engine chooses vb so that the stars of a plain shell reach a diameter of about 22 m per inch of calibre, then you can scale it with the bursting charge. Stars burn for 2-5 s and lose mass, which raises their ballistic coefficient as (1 - f u)-1/3: late in life they brake harder and droop. Tails are tiny sparks (about 2 mm) with a drag so high that they hang in the air while the star moves on.
Patterns. Peony and chrysanthemum are spheres of stars (a Fibonacci lattice here), willow uses slow gold charcoal stars with a long life, palm has a few thick arms, ring and heart are planar (tilted by your slider), crossette splits each star into four at 42 % of its life, Saturn and pistil combine two compositions.
Colour chemistry. Each salt is modelled as emission bands (centre, width, strength) of the molecule that actually radiates: SrCl and SrOH for red, CaCl for orange, atomic sodium D lines at 589 nm for yellow, BaCl for green, CuCl for blue, atomic lithium at 670.8 nm for crimson. Charcoal and metal fuels (Mg, Al, Ti) add an incandescent continuum, a Planck spectrum B(λ,T) = 2hc2/λ5 / (exp(hc/λkT) - 1). Above a dissociation temperature the band molecules break up and the line emission is lost; copper chloride gives up near 1400 K, which is why a good blue needs a cool, carefully balanced flame, while the continuum grows by about three orders of magnitude between 1300 K and 2000 K and turns the star white. The spectrum is converted with the CIE 1931 colour matching functions (Wyman et al. analytic fit) to sRGB. Pure spectral lines lie outside the sRGB gamut, so the line part is blended toward a typical perceived tone in proportion to its share of the light. The numbers for band centres are typical textbook values, the dissociation temperatures and the continuum scale are illustrative, not measurements of a real composition.
Sound. The bang is delayed by d / c with c = √(γ R T / M) (331.3 m/s at 0 °C, 340.3 m/s at 15 °C). On Mars (CO2, c about 230 m/s, density 1.5 % of Earth) it would be thin and slow, on the Moon there is no sound at all.
Simplifications. Shells are treated as spheres with a constant Cd (real shells tumble a little and include a lift-charge gas phase), the wind is a simple power-free shear, burst velocities are tuned to typical visual sizes (about 32 m of apex per inch and 22 m of burst diameter per inch), star counts are scaled for the frame rate, and no smoke opacity, shock wave or light attenuation is modelled in the physics. Educational model only: it contains no composition, quantity or construction data that could be used to make a pyrotechnic device.