Home▸Articles▸Mathematics

The Mathematics of Marching Squares Metaballs: Creating Smooth Shapes

A fascinating blend of mathematical algorithms that enable the creation of smooth and deformable shapes in 2D space.

mysimulator teamUpdated June 2026≈ 4 min read▶ Open the simulation

What Marching Squares Metaballs Are

Marching squares metaballs is an algorithmic approach that combines the principles of marching squares and metaball modeling. It starts by representing a 2D space with a set of points or fields, each having a value that influences its surroundings. The goal is to create smooth, deformable shapes from these fields.

The technique involves dividing the space into smaller regions (squares) and determining how to interpolate values across these regions based on the influence of nearby points. This process results in a continuous surface that can be manipulated in real-time.

Why It Happens

The underlying mathematics of marching squares metaballs relies on interpolation techniques to smoothly transition between different values within each square region. By assigning weights and using linear or higher-order interpolations, the algorithm ensures that the resulting shape is continuous and smooth.

This method works because it effectively creates a field where each point influences its neighbors, leading to a cohesive surface that can be deformed by changing the underlying points' positions or values.

live demo · related simulation● LIVE

Real-World Applications

Marching squares metaballs have numerous applications in computer graphics and simulation. They are used in video games, 3D modeling software, and even in scientific visualizations to represent complex fields such as fluid dynamics or terrain elevation.

In interactive simulations like the one on mysimulator.uk, this technique allows users to create and manipulate smooth shapes dynamically, providing a rich and engaging user experience.

How It Works

The process begins by defining a set of points or fields in 2D space. Each point has an associated value that influences its surroundings. The algorithm then divides the space into smaller squares and determines how to interpolate values across these regions based on the influence of nearby points.

By applying interpolation techniques, such as linear or higher-order methods, the algorithm ensures a smooth transition between different values within each square region, resulting in a continuous surface that can be manipulated in real-time.

Frequently asked questions

What is the difference between marching squares and metaballs?

Marching squares is an algorithm used to generate contours from a scalar field, while metaballs are points with influence fields that can be combined to create smooth shapes. When combined, they form marching squares metaballs.

How does the algorithm handle edge cases where values cross square boundaries?

The algorithm handles edge cases by interpolating values across the boundaries of each square region using linear or higher-order interpolation techniques to ensure a smooth transition between different fields.

Can marching squares metaballs be used in 3D space as well?

Yes, while marching squares and metaballs are traditionally 2D techniques, they can be extended to 3D using similar principles. This extension allows for the creation of smooth surfaces and volumes in three-dimensional space.

What are some practical applications of this technique?

Marching squares metaballs find applications in computer graphics, video games, scientific visualizations, and 3D modeling software to represent complex fields or create smooth, deformable shapes dynamically.

Try it live

Everything above runs in your browser — open Marching Squares Metaballs and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Marching Squares Metaballs simulation

What did you find?

Add reproduction steps (optional)