Interactive · free · no sign-up

Marching cubes, by hand

How does a 3D model get its triangles? The AI never draws them. It only answers one question, over and over: is this point inside the shape, or outside? Everything else is joining the dots. Start in 2D, where it's easy to see.

Part of our free crash course on 3D. This page goes with part 3, How to shrink a 3D model from a million triangles to 20,000.

Station 1 · flat, on paper

Squares on a grid

Step through it. Drag the shape around, change the grid, and hover any square to see what it does.

drag the shape

insideoutsidewhere an edge flips
Station 2 · one cube

Now one cube, in 3D

Same rules. A cube has 8 corners. Click corners to put them inside (blue). Every edge that runs from a blue corner to a grey one gets an orange dot, and the dots are joined into a small patch of triangles. Nothing is cut out of the cube: it just gets a patch. Drag to turn it.

click corners · drag to turn

There are only 256 ways to colour 8 corners, so the patch for each one is simply looked up in a table. That's the whole trick.

Station 3 · lots of cubes

Do it for every cube

Fill space with cubes and give each crossed cube its patch. Neighbours share their orange points, so the patches meet edge to edge into one sealed skin. Fewer, bigger cubes: a rough copy with few triangles. More, smaller cubes: a close copy and a lot of triangles, all about the same size, whether that bit of surface is plain or detailed. That's why an AI-made 3D model arrives with a million even triangles.

drag to turn

Questions

The short version

What is marching cubes?

A way to turn a shape into triangles. Fill space with a grid of small cubes, ask at every corner whether it's inside or outside, and give every cube with both kinds of corner a small patch of one to four triangles. The patches join into one sealed surface.

Why do AI 3D models have about a million triangles?

Image-to-3D generators such as TRELLIS, Hunyuan3D and Pixal3D decide inside or outside on a fine 3D grid, often hundreds of cubes along each side, and wrap the surface with marching cubes. Every cube the surface passes through gets a couple of triangles, flat bit or detailed bit alike.

Why do thin parts and small details disappear?

The grid only knows its corners. If both ends of an edge are on the same side, it assumes nothing crosses there, so anything thinner than one cube, like the gap between two fingers, can vanish. Smaller cubes keep more, at the cost of many more triangles.

How do you get a game-sized model from that?

Shrink it: simplify, remesh or retopologise, then bake the lost detail into a normal map. Part 3 of our crash course walks through it: How to shrink a 3D model from a million triangles to 20,000.

Make your own 3D models

AssetFurnace turns a picture or an idea into a textured, game-ready 3D model with a skeleton and animations, on your own computer. Free and open source.

See AssetFurnace

New to 3D? Start the crash course: What a 3D model actually is.