Log inGet started
World

Furrow

Branchmain
Branchesmain
Commita021443d7c

README.md

wormBody

The animal's geometry. Every piece of the sandworm is a runtime mesh built here and uploaded once: the carapace plates the body is made of, the head, the counter-rotating maw rings, the lit gullet behind them, the tail, and the sand ridge that rides above the buried body.

Everything is built at unit radius around the local +Z axis, so the caller scales a piece to whatever size that part of the animal is. The head is the exception: it is built in its own real proportion — radius 1 at the neck, 3.4 long — and scaled uniformly, which is what lets the maw rings and the gullet hang off it as children in the head mesh's own units.

M.loft is the shared builder: a profile function gives the radius and z of each ring, a shape function gives the extra radius at an angle. The plates, the head, the gullet and the tail are all a few lines of those two.

The plates carry UVs the chitin shader reads as (angle around, distance along) and tangents that run around the circumference, which is the axis its anisotropic stretch is taken on. M.plate(spines) returns a plain plate, one with a raised dorsal keel, or one with a keel and a lateral spike either side — every few segments takes the heavier variant, so the silhouette against the sky has a rhythm without costing another entity.

M.mound is one slice of the furrow, and it is a single sheet rather than a closed prism: the flanks run out and dive under the ground instead of dropping to a vertical wall, so there is no face that can catch the light the wrong way at a grazing angle — which is exactly the angle the film watches the furrow from.