Articles & experiments /Development notes

Meshes, heightfields and volumes

The same scraping stroke can stretch triangles, lower a grid or rebuild a surface. Three ways of storing a pumpkin wall explain why a shallow groove and a hollow under intact skin are different problems.

This series · Part 4 of 5Drop Dead Gourdgeous
  1. Drop Dead Gourdgeous
  2. Making clean pumpkin cuts
  3. Scraping pumpkins
  4. Meshes, heightfields and volumes
  5. Building a candle maker
Series overview

A scrape changes the shape. What stores that change?

A shallow scrape seems like a small operation: move a spoon across the skin and leave a groove. Keep digging, or reach in from the side, and the choice of surface model becomes visible. Can it keep enough detail in the deep groove? Can it leave an intact roof over a hollow?

The same spoon and stroke can produce different results depending on how the surface is stored. We compared three approaches in the flat-wall lab. The important test was what each could represent when a shallow scrape became a deep groove or reached in from the side.

A mesh stores points joined into faces. A heightfield stores one surface height at each horizontal sample. A distance field stores values throughout a volume, from which we build a new mesh. All three can draw triangles on screen; they differ in what remembers the cut between strokes.

An ivory sheet with a printed triangular mesh and dots at its vertices. The existing connections follow a shallow depression.

Mesh: points and connections

Move the existing vertices. In this test, their triangle connections stay fixed.

A regular horizontal grid with one vertical line and one top dot at each sample. The top dots describe a shallow depression.

Heightfield: one top per sample

Keep the horizontal grid fixed. Each position stores one surface height.

Three offset sample slices through a wall. Filled dots indicate solid material; hollow dots indicate air. Samples leave a hollow below an intact roof.

Volume: samples through space

Store field values throughout the material. Extract a surface mesh from those values afterward.

  • Solid
  • Air
These are storage models, not three different ways to display the final picture. A heightfield or a sampled volume can also produce a triangle mesh for rendering.
Back to contents

Move the existing vertices.

The first approach pushes the mesh’s existing points out of the spoon and relaxes their spacing. It keeps the same triangle connections. A deep groove can pull those points apart, leaving long faces where the cut needs more detail. In the recorded slab comparison, the worst mesh edge stretched to about 3.5 times its original length. We rejected this as the removal method, while keeping it as a comparison.

That is a familiar problem in sculpting. Blender’s dynamic topology adds and removes geometry as the shape changes. Our pushed-vertex test kept its original connections; relaxing the points did not give it new triangles.

That does not make moving vertices useless. It exposes the limit of this particular removal method: the shape was changing while its triangle connections stayed fixed. A deeper mark asked for new surface detail that the model never created.

Back to contents

Keep one height per column.

A heightfield fixes the horizontal sample positions and changes their heights. Imagine a regular set of columns, each with one top. The spoon lowers the tops it touches. The grid does not stretch sideways, and comparing a changed top with its original height tells us how much material has gone.

That makes a heightfield useful for shallow, open scraping and for an even-depth stop. But one column cannot hold both an intact roof and a hollow beneath it: that would need more than one surface height at the same horizontal position. In the recorded side-entry test, the undercut became an open trench.

Snow tracks supplied the starting idea for the scraping tools. That article follows the depth controls and remaining-wall light; here, the roof is the useful test of the representation itself. Finer spacing can add detail, but it cannot remove the one-height limit.

A gold wall cross-section with orange skin. A side-entry hollow leaves an intact roof and floor. One marked vertical column crosses solid, air, then solid.

The shape we want to keep

At the marked column, material remains above and below the air gap: roof, air, floor.

The same cross-section stored with one top height per horizontal sample. The marked column has been lowered to the floor, removing the roof. A dotted outline marks the roof that was lost.

One height loses the roof

Choose the lower surface and the hollow becomes an open trench. Choose the roof instead and the hollow fills in.

Side view of one hollow. This comparison assumes one top height per horizontal sample above a fixed base. A mesh can represent an overhang; layered fields or separate meshes can also extend a simple heightfield.
Back to contents

Build new triangles where they are needed.

The distance-field version stores inside and outside in a three-dimensional grid. A cut changes those samples. Marching cubes then walks the affected cells and creates triangles where the boundary crosses them. It can rebuild a hollow under intact skin, because it is not limited to one surface height.

The grid can record outside, then solid roof, then empty space, then solid floor along the same vertical line. That is why the undercut can survive. Marching cubes is the step that turns the updated volume boundary back into a visible mesh; it does not make the stored samples infinitely detailed.

That flexibility costs more storage and meshing work. We rebuild affected chunks, then combine them into larger meshes for drawing. Rebuilding locally and drawing in batches are separate decisions: a small scrape should not require hundreds of separate draw calls.

Those results belong to the recorded slab experiment, not a benchmark for every mesh or phone. Grid spacing limits detail in the heightfield and distance field; the moving-mesh volume estimate also becomes less reliable when its points slide sideways.

Back to contents

The flat slab answers a smaller question.

The recorded comparison isolates removal on a flat wall. Its roughly 3.5-times edge stretch belongs to that pushed-vertex experiment, with its own spacing and stroke. It is not a general performance score or a prediction for a particular phone.

On the pumpkin, changed depths are stored in tiles around the curved wall. Local patches are displaced and rebuilt, then clipped against the shell left by earlier cuts. A scrape must still meet the edge of an eye or lid cleanly. The app combines this curved patch path with solid carving; the three-dimensional grid remains a separate flat-lab comparison.

That curved path has different responsibilities: follow the pumpkin’s ribs, retain remaining-wall data and meet an existing eye or lid edge. The flat distance-field model remains a research alternative in the lab; the comparison is not a menu of surface models in the full app.

The distance-field studies also fed the candle maker. A technique can travel between tools while each tool still needs its own checks for the shapes and edits it permits.

Back to contents

Repeat one stroke with a different model.

Open the scraping lab and choose “Mesh with pushed vertices,” “Heightfield,” or “Distance field, remeshed.” Repeat a short groove, then try a deeper stroke. Changing the model resets the slab, so each comparison begins with a fresh wall.

Look for stretched faces in the pushed mesh and the regular sampling of the heightfield. The side-entry roof diagram above explains a structural limit that an ordinary top-down groove cannot reveal. The lab is a controlled comparison, not a complete test of the curved pumpkin’s carving, materials or light.

Back to contents