All projects

A human body from anatomical atlases, with a circulatory system grown by an algorithm

Vessels

A human body in the browser: the skeleton, the organs and the main vessels come from open anatomical atlases, and the small vessels that reach every organ are grown by an algorithm when the page loads. A pulse wave travels from the heart through 86,565 segments.

Role
Idea, data pipeline, algorithms, graphics and measurements.
Stack
  • TypeScript
  • React 19
  • three.js
  • React Three Fiber
  • GLSL
  • Web Worker
  • Blender
  • Vitest
Live
vessels-oktawian.vercel.appgithub.com/mauupa0/vessels-3d
Vessels website

Problem

I wanted to combine real anatomical data with geometry generated on the fly and see how much a browser can draw smoothly. A circulatory system is a good test: tens of thousands of thin tubes that have to stay inside organs and steer around bones.

What I built

  • An offline pipeline: two atlases (Z-Anatomy and BodyParts3D) extracted with headless Blender, registered into one frame on 120 shared bones and compressed to 1.46 MB of meshes.
  • A label volume from 6 and 3 mm voxels: vessel growth knows which organ it is in and steers around bone.
  • Small vessels grown by space colonization in a Web Worker, radii from Murray's law, never thicker than the atlas vessel they grow from.
  • Tubes built in the vertex shader, one draw call per tree, with hover and click through GPU picking instead of a raycaster.
  • Clicking an organ isolates it and lights up the vessels that feed it. Plus a section plane in three directions, heart rate, and a pause in which no frame is drawn.

By the numbers

vessel segments on desktop, 43,896 on phone
86,565
on desktop and in the phone profile
60 fps
mm registration error between the two atlases (RMS)
13.7
deliberate bugs caught by the tests
20/20

Decisions that mattered

An atlas instead of a mannequin

The first version generated the body from ellipsoids. Real organs and bones needed an atlas, so the check whether a point is inside the body became a volume baked from the meshes.

Instancing and GPU picking

Each vessel tree is one geometry with one instance per segment. Hover renders ids into a 1 x 1 pixel target, so 300k triangles per layer need no BVH.

Tests verified by mutations

65 tests guard Murray's law at every node, determinism per seed, branches never leaving an organ and the direction of the pulse wave. A script breaks the code in 20 places, and each one has to turn a test red.