Simulation and Reality
There’s something deeply satisfying about watching a fluid simulation run. The particles flow, collide, splash—behaving in ways that feel natural, almost organic. But this naturalness is an illusion, a carefully constructed approximation of reality.
When building Vortex, I spent months tweaking parameters: smoothing radius, time step, viscosity. Small changes produced dramatically different results. A simulation that looked like water could, with a slight adjustment, look like honey or smoke.
The Mathematics of Approximation
Fluid dynamics is governed by the Navier-Stokes equations, a set of partial differential equations that describe how fluids move. Solving these exactly is computationally intractable for all but the simplest cases. So we approximate.
SPH—Smoothed Particle Hydrodynamics—replaces the continuous fluid with discrete particles. Each particle represents a small volume of fluid, carrying properties like density, pressure, and velocity. The equations are solved by summing contributions from nearby particles, weighted by a smoothing kernel.
The kernel function is crucial. It determines how particles interact, how “smooth” the simulation appears. Too narrow, and you get particle clumping. Too wide, and the fluid becomes diffuse, losing its cohesive properties.
This equation looks simple, but the choice of and determines everything. There’s no “correct” value—only values that produce results that look right.
The Art of Parameters
Simulation is part science, part art. The physics is real, but the parameters are tuned for visual appeal. A simulation that’s physically accurate might look wrong—too viscous, too turbulent, too slow. A simulation that looks right might be physically inaccurate.
This tension appears everywhere in graphics. Vortex uses adaptive time stepping: when particles move fast, we use smaller time steps to maintain stability. This isn’t just about correctness—it’s about preventing visual artifacts. A particle that moves too far in one frame breaks the illusion of continuity.
Similarly, surface reconstruction—converting particles into a renderable surface—is an aesthetic choice. We could render particles directly, but surfaces look better. The algorithm we use (marching cubes, screen-space fluid rendering) affects the visual style as much as the physics.
The Limits of Simulation
Every simulation has limits. Vortex can handle millions of particles in real-time, but not billions. We can simulate water and oil, but phase transitions (liquid to gas) are still experimental. Surface tension works, but thin films are challenging.
These limits aren’t just computational—they’re fundamental to the approximation. SPH assumes the fluid is incompressible, which works for liquids but not gases. It assumes particles are small relative to the simulation domain, which breaks down at very small scales.
The question isn’t whether the simulation is “correct”—it’s whether it’s correct enough for the purpose. For games and visualization, visual plausibility matters more than physical accuracy. For scientific simulation, accuracy is paramount, even if it means sacrificing real-time performance.
Simulation as Understanding
But simulation isn’t just about producing pretty pictures—it’s a tool for understanding. When you tweak parameters and watch the results, you develop intuition about how fluids behave. You see how viscosity affects flow, how surface tension creates droplets, how pressure waves propagate.
This intuition transfers to real-world understanding. After working on Vortex, I notice fluid behavior everywhere: how coffee swirls in a cup, how water flows down a drain, how smoke rises from a fire. The simulation becomes a lens for viewing reality.
The Future
As GPUs become more powerful and algorithms improve, simulations will become more accurate and more detailed. Real-time simulations of billions of particles are already possible. Photorealistic fluid rendering is within reach.
But the fundamental challenge remains: balancing accuracy, performance, and visual appeal. The best simulations aren’t the most physically accurate—they’re the ones that best serve their purpose, whether that’s entertainment, education, or scientific discovery.