Skip to content

Modeling ​

Tools for making your own shapes in code, beyond makeShape, lathe and extrude. Everything here returns plain data (points or meshes), so it works with every renderer, and meshes come with texture coordinates and clockwise faces like the built-in shapes.

js
import {
  spline, resamplePath, sweep, loft, subdivideMesh, bevelMesh, blobMesh, blobField, sdfMesh,
  booleanMesh, unionMesh, subtractMesh, intersectMesh,
  mirrorMesh, symmetrizeMesh, bisectMesh, arrayMesh, radialArrayMesh, mirrorObject, arrayObject, radialArrayObject,
  taperMesh, twistMesh, bendMesh, bulgeMesh, sculptMesh, remeshMesh,
  makeLattice, latticePoints, latticeMesh, latticeCage, applyModifiers, MODIFIERS, weldVertices, cleanMesh, validateMesh, fixWinding,
  dropOnto, attachTo, alignObjects, distributeObjects,
  meshQuery, raycastMesh, pointInMesh, distanceToMesh, closestPointOnMesh, isClosed, raycastScene,
} from "./trid/index.js";
PageTools
Curves, sweeps & loftsspline, resamplePath, sweep, loft
Subdivision & bevelssubdivideMesh, bevelMesh
BlobsblobMesh, blobField, sdfMesh
BooleansbooleanMesh, unionMesh, subtractMesh, intersectMesh
Mirror & arraymirrorMesh, symmetrizeMesh, bisectMesh, arrayMesh, radialArrayMesh, and the same for objects
DeformerstaperMesh, twistMesh, bendMesh, bulgeMesh
SculptingsculptMesh: inflate, grab, smooth, flatten, pinch, crease, noise; remeshMesh
LatticemakeLattice, latticePoints, latticeMesh, latticeCage
Modifier stackapplyModifiers, MODIFIERS: steps applied in order, as data
Cleanup and checksweldVertices, cleanMesh, validateMesh, fixWinding
Rays, inside and distancemeshQuery, raycastScene, isClosed and one-off helpers
Placing objectsdropOnto, attachTo, alignObjects, distributeObjects

Which tool for which shape ​

You wantUse
A body, a creature, something soft or organicBlobs: shapes that melt together
A tail, a horn, a pipe, a rope, a handlesweep along a spline
A bottle, a hull, a head: a shape whose cross-section changesloft
A vase, a wheel, a lamp: turned around an axislathe
A flat outline with depth: a logo, a key, a starextrude
Something smooth, built from a few boxessubdivideMesh
Holes, windows, notches, cut-outs; or one solid from overlapping partsBooleans: subtract, union, intersect
Furniture, devices, robots: soft edgesbevelMesh, or makeShape("box", { radius })
Anything symmetric: a chair, a face, a car, a creatureBuild one half, then mirrorMesh; or symmetrizeMesh a lopsided one
Rows, fences, stairs, spokes, petals, legs around a tablearrayMesh and radialArrayMesh, or the object versions
Faces, creatures, details: cheeks, snouts, mouths, wrinkles, rough skinsculptMesh on a dense mesh, with symmetry: "x"
One smooth body from overlapping parts, or any shape made sculptableremeshMesh
A shape you'll tweak and rebuild, or describe as data (saved, sent, written by an AI)Modifier stack
A whole shape reshaped with a few points: a wider top, a pinched waist, a lean, a twistLattice
A trunk that tapers, a twisted column, a bent armDeformers
Rocks, terrain, wobbly surfacesdisplaceMesh with noise
Parts that rest on each other: a cup on a table, rocks on the ground, a roof on wallsdropOnto
Horns, handles, ears or spikes growing out of a surfaceattachTo
Legs on the same floor, things centered or evenly spacedalignObjects, distributeObjects
Eyes, buttons or pebbles placed on a surfacemeshQuery or raycastScene
A mesh from a file or your own code that looks wrongCleanup and checks

Putting it together ​

The fox on the home page uses most of these: a body, a head and fluffy cheeks of blobs, ears lofted from an oval to a point, a tail swept along a spline, eyes placed on the face with rays, and a beveled round platform. Its code is in docs/demos/fox.js.