iBrain — an interactive atlas of the human brain
The problem I started from
Most of us learn the brain as a flat diagram: a side view, a few labelled arrows, a mnemonic. It works for a quiz and fails for understanding — you can't rotate a drawing, you can't ask it where the hippocampus sits relative to the thalamus, and you can't see that the structure you just memorised is three millimetres across.
Meanwhile the data to do better already exists. Universities have published open anatomical atlases with hundreds of individually segmented structures. That information spends its life inside research tools that no student would ever open. My starting question was simple: what does the brain look like if you can just touch it?
What inspired me
Healthcare education has a comprehension gap, not an information gap. When someone is told a family member has damage to the hippocampus, or that a tumour is in the frontal lobe, the words are accurate and completely opaque. Diagrams don't close that gap because they remove the one thing that makes anatomy click: spatial relationships.
I also wanted to prove something to myself. The interesting part of an atlas isn't rendering a brain — it's keeping 234 structures separately addressable, so that every one of them can be selected, named, explained and hidden. That is a data problem disguised as a graphics problem, and it's where most "3D brain" demos quietly flatten everything into one mesh and give up.
How I built it
Sourcing, not generating. I refused to model a brain from scratch. I evaluated open atlases and chose Z-Anatomy (derived from BodyParts3D), which ships as a Blender file with a real anatomical hierarchy — each gyrus and sulcus as its own object. The full atlas is a 307 MB whole-body file; I extracted only the brain subtree, which came out as 234 meshes with names like Precentral gyrus (Left) and a collection path down to the lobe.
Cleaning and normalising. The raw extract had real defects: a stray vertex 47 cm outside the body on the hypothalamus (which silently corrupted every bounding box), 28 loose vertices across five meshes, and 203 structures shipped render-hidden, which made a USD export drop them without warning. I normalised the model to true scale — 0.1378 × 0.1807 × 0.1608 m, centred at the origin, Y-up — and organised it into eight systems: cerebral cortex, cerebellum, brainstem, diencephalon, basal ganglia, limbic system, white matter, ventricular system.
Budgeting for a phone. The brain subtree was 660,537 triangles. I decimated to 0.35, keeping the silhouette with a small emissive tint on the surface, which landed at 234,618 triangles and an 11 MB USDZ. Camera framing came straight from the projection geometry,
$$h = 2d\tan!\left(\frac{\phi}{2}\right)$$
with a 36° field of view and $d = 0.62\ \text{m}$, giving a visible height of about 0.40 m — so a 0.161 m brain occupies roughly 40% of the frame with room for the information card. That single equation replaced a lot of trial-and-error.
Getting it into RealityKit. Exporting kept one prim per structure (never merged), which is what makes selection possible. The app loads the USDZ, walks the entity tree, and builds an index from prim name to anatomical record supplied by a CSV manifest — so the Swift code contains no hard-coded anatomy. Everything the UI says about a structure comes from data.
The interaction layer. SwiftUI for the shell, an ARView in non-AR mode for the renderer, one-finger drag to rotate, pinch to zoom, tap to select, with a floating card that names the structure, gives its system and a short scientific description, and offers "Learn more" for deeper content.
What I learned (1/2)
- Licensing is an engineering constraint. Z-Anatomy is CC BY-SA 4.0, which is compatible with shipping but obliges you to publish your adapted model under the same licence. I evaluated a second atlas (the SPL-PNL Brain Atlas, 3D Slicer licence, 328 structures) purely so the project has a commercially unencumbered path if that obligation ever became a problem.
- Data quality decides the visual ceiling. Half the "graphics work" was fixing vertices, hidden flags and shared mesh datablocks. A perfect renderer on broken geometry still looks broken.
- Names are the API. RealityKit appends suffixes to duplicated prim names (Pons_Left_001), so matching has to be normalised and de-duplicated — this was the difference between a beautiful static model and a selectable one.
The challenges I actually hit
Swift treats "\r\n" as a single Character. My CSV parser compared characters against "\n" and never matched, so 235 rows parsed as one row with 2,116 columns. The app told me the atlas manifest was empty, which was true and completely misleading.
USDZ materials can't be reliably restored. My first highlighter swapped the selected structure's material and swapped it back on deselect. The swap would apply, the restore silently wouldn't, and after one tap the entire brain stayed grey. I rebuilt highlighting as a cloned overlay entity with its own material, which is trivially reversible: remove it from the parent and you are back to the shipped state.
Hit-testing doesn't exist by default. A model loaded from USDZ has no collision shapes, so taps hit nothing. Generating them once at load made selection work — and taught me that a tap through the hairline gap between two gyral shells can legitimately land on the white matter underneath.
The model is Z-up, RealityKit is Y-up. Before the fix, the "front of the brain" was the top of the head.
Where the AI goes
The current build is deliberately the foundation, not the finished thesis: it proves that a real atlas can be individually addressable and pleasant to explore on a phone. The next layer is where this becomes an AI × healthcare project rather than a 3D viewer. Because every structure is a first-class record with a system, a side and a description, an AI layer can generate explanations at the level of the structure a student is looking at, build a personalised learning path through the systems they keep failing, and answer "what happens if this is damaged?" without hallucinating geometry. Clinically, the same index supports patient conversations: point at the region on a scan report, not at a word.
Built with
Swift, SwiftUI, RealityKit, USDZ, Blender (headless Python pipeline), Z-Anatomy / BodyParts3D (CC BY-SA 4.0), SPL-PNL Brain Atlas (evaluated alternative, 3D Slicer licence). The mesh pipeline, export and verification were automated — every one of the 234 prims is programmatically checked against the manifest before the app is built....
Built With
- 3d
- swift