The physics of a soap bubble
Ooh Bubbles is a little room full of soap bubbles that you can pop, blow and watch drift. It isn’t an animation: every bubble is simulated, frame by frame, from the physics of real soap films. Here is what is going on, and where the ideas come from.
What a bubble really is
A bubble is a sheet of soapy water, usually thinner than a thousandth of a millimetre, wrapped around a pocket of air. The sheet has two surfaces, inside and outside, each lined with soap molecules. In Ooh Bubbles that soap is a simple recipe: a weak solution of SDS (sodium dodecyl sulfate, the detergent in many cleaners) in pure water.
Why bubbles shimmer with colour
Soap is almost colourless, so where do the rainbows come from? When light hits the film, a little reflects from the outer surface and a little from the inner one. The second reflection travels slightly further. For some colours the two reflections line up and get brighter; for others they cancel out. Which colours win depends on how thick the film is and the angle you view it from. This is called thin-film interference.
Ooh Bubbles works this out properly: it splits white light into 64 bands of colour from violet to deep red, computes how much of each band reflects at every film thickness and viewing angle (accounting for water bending different colours slightly differently), and then converts the result into the colour your screen shows. The colour maths uses the standard CIE 1931 colour-matching functions [1].
Simplifications: the film is treated as perfectly clear water-like liquid; real soap has a slightly different refractive index, and the light source is an idealised warm-white glow.
Draining and thinning
The moment a bubble forms, gravity starts pulling its liquid downward. The top gets thinner and the bottom collects a heavier rim. At the same time water evaporates into the room. As the film thins, its colours shift: the top of an old bubble looks different from a fresh one.
The simulation tracks each bubble’s average thickness with a thinning law measured on real bubbles by Lhuissier and Villermaux [2], thins the top faster using the classic formula for liquid draining down a vertical film, and adds evaporation that depends on the room’s humidity [3]. Liquid that drains away gathers into a little drop at the bottom of the bubble.
Simplifications: real films also thin through small swirling patches at their edges (“marginal regeneration”); that is not simulated, and the fine colour bands you see are drawn with tuned rules rather than solved fluid flow. The thinning law was measured on bubbles sitting on water and is applied here to free-floating ones.
Surface tension and the wobble
Surface tension is the pull that makes a water surface behave like a stretched skin. It is what makes a bubble round, and it is why a bubble jiggles when air pushes it. Squash a bubble a little and surface tension pulls it back; it overshoots, and it rings like a soft bell before settling down.
Ooh Bubbles gives every bubble its three simplest shape vibrations: egg-shaped, pear-shaped and four-lobed. Their frequencies come from Horace Lamb’s classic theory of vibrating drops [4], adapted for a film with two surfaces and air on both sides. Big bubbles wobble slowly (around 2 times a second for a 12 cm bubble) and small ones quickly (around 75 times a second at 1 cm). How fast the wobble dies away comes from the friction of air near the film [5], and the results agree reasonably with measurements on real soap bubbles [6].
Surface tension itself depends on the soap. More soap molecules at the surface means a weaker pull, and the simulation uses measured data for SDS to work out how strong it is [7].
Simplifications: the wobble model is for small wobbles; very violent squashes are softened rather than solved exactly.
How a bubble pops
How it starts. A bubble can pop at any moment, but the thinner it gets, the more likely it is. Each bubble in the sim has a chance of popping that rises as it drains [8]. If its top thins all the way to about 25 nanometres (into the range where films become unstable [9]), it pops for certain. You can of course pop one yourself by tapping it.
The racing rim. Once a hole opens, surface tension pulls the film back from the edge. The liquid piles up into a rim that races across the bubble at a steady speed set by just two things: the film’s surface tension and its thickness. The thinner the film, the faster it goes, often several metres per second. This speed was worked out by G. I. Taylor [10] and Fred Culick [11] around 1960 and is now called the Taylor–Culick speed. The sim uses it locally, so a hole sweeps over a bubble’s curved surface faster where the film is thin.
The spray. As the rim moves, it flaps and sheds tiny droplets, mostly tens of micrometres across [12][2]. The sim sizes these droplets from the bubble’s radius and film thickness, gives them a natural spread of sizes, and lets air drag slow them down, using the classic Schiller–Naumann drag formula for small spheres [25]. The popping film also gives the surrounding air a little push.
When the spray hits another bubble. A droplet that lands on a nearby bubble is caught. The receiving bubble soaks up the droplet’s water, soap, glycerol and heat, and takes on its push, as if the two stuck together. It does not pop. That is what experiments show: drops striking soap films bounce, partly merge, or pass right through while the film heals behind them [26]; water drops a few tens of micrometres across merged with or tunnelled through thin films, and no impact ever broke one [27]; and micron-sized drops cross a film that then seals itself [28]. A drop can trigger a burst if its liquid has a lower surface tension than the film, pulling the film apart [8], but our spray is made of the same soap solution as the bubble it hits, so there is no such pull.
Simplifications: the pop-rate constant comes from studies of water bubbles and is reused for soap; the droplets don’t evaporate; and chain-reaction popping is turned off. Captured droplets always stick: bouncing and passing through aren’t modelled. The spray is released once the rim has finished its sweep, at most about 10 milliseconds late. The popping film is treated as a few hundred small patches, each shedding its own droplets. And capture only applies to bubbles that are close to round; strongly squashed or joined bubbles use the ordinary collision handling instead.
Glycerol, and the soap recipe
Bubble-blowing mixes often add glycerol, which makes the liquid thicker and slows drainage so bubbles last longer. The engine contains measured laws for how glycerol changes the density [13] and viscosity [14] of water, but the recipe you see by default is the simple one: dilute SDS in water, with no glycerol. Its viscosity is set close to water’s, using measurements of SDS solutions [15].
Floating, sinking and drag
A bubble filled with ordinary air weighs a little more than the air it displaces (its film is water, after all), so it slowly sinks. The bubbles here carry a little helium, about 8% of their gas, which makes a typical 4 cm bubble just about float, film and all; the settings let you fill them with room air or breath instead. The air around them carries them along. The sim includes gravity, buoyancy, and the drag of air on a sphere, using a drag correlation by Morrison that holds from very slow, smooth flow up to fast, turbulent flow, and that reduces exactly to Stokes’s law at low speeds [16]. A moving bubble also has to push air out of the way, which makes it act heavier than it is (the “added mass” effect), and it follows gusts in the moving air. Spinning bubbles feel a small sideways lift [17][18]. The air inside is slightly pressurised by the film’s surface tension, as for any real bubble.
Wind, breath and bumping
The room’s breeze is gentle swirling turbulence that drifts along with the wind. When you choose Blow, a soft jet of air comes from your pointer; it behaves like a small fan rather than a carefully measured human breath. Bubbles that bump cushion against a thin layer of trapped air and bounce off [19]; gentle bumps sometimes stick into a double bubble with a shared wall, which later merges or separates, keeping track of all the gas and liquid. Over long times, gas also slowly seeps through the film itself [20].
How this compares
To our knowledge, Ooh Bubbles is one of the most physically comprehensive real-time soap-bubble simulations available in a browser. It combines spectral thin-film rendering with reduced physical models of drainage, evaporation, gas exchange, deformation, collisions and bursting, all running interactively.
It isn’t alone. Other lovely browser pieces include Oimo Bubbles and A Great Variety of Colours, which simulates film flow, drainage and Taylor–Culick holes, and researchers have shown real-time thin-film interference driven by shallow-water flow [21]. Offline research simulations, which take seconds to minutes per frame, go much further in places: coupled soap and thickness flow on a bubble [22], swirling vortical films [23], and large deformations, foams and break-up [24].
What it doesn’t do
We try hard not to overclaim. Ooh Bubbles does not simulate the soap molecules flowing around the surface (the “Marangoni” effect is switched off), the swirling edge-thinning of real films, or the detailed pinch-off of a bubble from a wand. Some numbers (like the pop-rate constant) come from related experiments rather than from soap bubbles exactly. Within those limits, what you see follows the physics above.
Which devices work best
Every bubble is simulated live, so the scene asks a lot of the graphics chip. It is best on an iPhone 16 Pro or newer, or a recent Mac or PC, in current Safari, Chrome or Edge. Those hold a smooth 60 frames a second with the full look.
On older or busier devices, such as an iPhone 15, the studio keeps things smooth by running a lighter version: fewer bubbles and simpler colour shading. If it is still struggling after that, it settles into a calm scene with only a few bubbles. You’ll see a short note once when this happens. It never lowers the screen resolution, so what is drawn stays sharp.
The first visit also downloads the physics engine, which can take several seconds on a phone; later visits start much faster. The studio needs WebGPU: current Chrome and Edge on computers and Android, and Safari on an up-to-date iPhone, iPad or Mac.
Sources
- Wyman, C., Sloan, P.-P., Shirley, P. (2013). Simple analytic approximations to the CIE XYZ color matching functions. Journal of Computer Graphics Techniques 2(2). jcgt.org/published/0002/02/01
- Lhuissier, H., Villermaux, E. (2012). Bursting bubble aerosols. Journal of Fluid Mechanics 696, 5–44. doi:10.1017/jfm.2011.418
- Miguet, J., et al. (2020). Stability of big surface bubbles: impact of evaporation and bubble size. Soft Matter. doi:10.1039/C9SM01490J
- Lamb, H. (1932). Hydrodynamics, 6th ed., §275. Cambridge University Press. archive.org
- Miller, C. A., Scriven, L. E. (1968). The oscillations of a fluid droplet immersed in another fluid. Journal of Fluid Mechanics 32. doi:10.1017/S0022112068000832
- Kornek, U., et al. (2010). Oscillations of soap bubbles. New Journal of Physics 12, 073031. doi:10.1088/1367-2630/12/7/073031
- Weißenborn, E., Braunschweig, B. (2019). Specific ion effects of dodecyl sulfate surfactants with alkali ions at the air–water interface. Molecules 24, 2911. doi:10.3390/molecules24162911
- Poulain, S., Villermaux, E., Bourouiba, L. (2018). Ageing and burst of surface bubbles. Journal of Fluid Mechanics 851, 636–671. doi:10.1017/jfm.2018.471
- Vrij, A. (1966). Possible mechanism for the spontaneous rupture of thin, free liquid films. Discussions of the Faraday Society 42. doi:10.1039/df9664200023
- Taylor, G. I. (1959). The dynamics of thin sheets of fluid. III. Disintegration of fluid sheets. Proceedings of the Royal Society A 253. doi:10.1098/rspa.1959.0196
- Culick, F. E. C. (1960). Comments on a ruptured soap film. Journal of Applied Physics 31. doi:10.1063/1.1735765
- Lhuissier, H., Villermaux, E. (2009). Soap films burst like flapping flags. Physical Review Letters 103, 054501. doi:10.1103/PhysRevLett.103.054501
- Volk, A., Kähler, C. J. (2018). Density model for aqueous glycerol solutions. Experiments in Fluids. doi:10.1007/s00348-018-2527-y
- Cheng, N.-S. (2008). Formula for the viscosity of a glycerol–water mixture. Industrial & Engineering Chemistry Research. doi:10.1021/ie071349z
- Kushner, L. M., et al. (1952). A viscometric study of the micelles of sodium dodecyl sulfate in dilute solutions. Journal of Research of the National Bureau of Standards 49. doi:10.6028/jres.049.011
- Morrison, F. A. (2013). An Introduction to Fluid Mechanics. Cambridge University Press. doi:10.1017/CBO9781139047463. Drag correlation: Morrison, F. A. (2016), “Data correlation for drag coefficient for sphere”, Eq. (1), pages.mtu.edu/~fmorriso
- Rubinow, S. I., Keller, J. B. (1961). The transverse force on a spinning sphere moving in a viscous fluid. Journal of Fluid Mechanics 11. doi:10.1017/S0022112061000640
- Zhou, Zhang, Xu (2022). Experiments on the drag and lift coefficients of a spinning sphere. Water 14, 2593. doi:10.3390/w14172593
- de Ruiter, J., et al. (2014). Wettability-independent bouncing on flat surfaces mediated by thin air films. Nature Physics. doi:10.1038/nphys3145
- Sander, R. (2023). Compilation of Henry’s law constants (version 5.0.0) for water as solvent. Atmospheric Chemistry and Physics 23. doi:10.5194/acp-23-10901-2023
- Gu, Dai, Chen, et al. (2024). Real-time simulation of thin-film interference with surface thickness variation using the shallow water equations. Computer Animation and Virtual Worlds 35(4), e2289. doi:10.1002/cav.2289
- Huang, W., et al. (2020). Chemomechanical simulation of soap film flow on spherical bubbles. ACM Transactions on Graphics 39(4). doi:10.1145/3386569.3392094
- Tao, Ruan, Deng, et al. (2024). A vortex particle-on-mesh method for soap film simulation. ACM Transactions on Graphics 43(4), 53. doi:10.1145/3658165
- Deng, Y., et al. (2022). A moving Eulerian-Lagrangian particle method for thin film and foam simulation. ACM Transactions on Graphics 41(4). doi:10.1145/3528223.3530174
- Schiller, L., Naumann, A. (1933). Über die grundlegenden Berechnungen bei der Schwerkraftaufbereitung. Zeitschrift des Vereines Deutscher Ingenieure 77, 318–320. (Print only; no DOI.)
- Gilet, T., Bush, J. W. M. (2009). The fluid trampoline: droplets bouncing on a soap film. Journal of Fluid Mechanics 625, 167–203. doi:10.1017/S0022112008005442
- Kim, I., Wu, X. L. (2010). Tunneling of micron-sized droplets through soap films. Physical Review E 82, 026313. doi:10.1103/PhysRevE.82.026313; arXiv:1708.04331
- Courbin, L., Stone, H. A. (2006). Impact, puncturing, and the self-healing of soap films. Physics of Fluids 18, 091105. doi:10.1063/1.2336102