# wesbos/3d-model-anything architecture

> Architecture diagram of the GitHub repository wesbos/3d-model-anything, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wesbos/3d-model-anything
- Repository: https://github.com/wesbos/3d-model-anything

## Overview

3D Model Anything combines an iPhone evidence-capture app, an agent-guided reconstruction workflow, and a Three.js viewer with interactive room physics. The main user journey is capture and export a room, use the scan-to-threejs skill to iteratively model and compare it, then inspect the resulting scene in viewer modes. Edges are limited to README statements and visible source-index references; several app and viewer capabilities are documented but their implementation was not sampled, so those links are omitted or marked unverified.

Main entry points: [`apps/room-viewer/src/main.ts`](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/main.ts) (Viewer Entry), [`apps/house-capture/HouseCapture/CaptureController.swift`](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/CaptureController.swift) (Capture Session), [`packages/room-physics/physics.ts`](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/physics.ts) (Room Physics), [`apps/room-viewer/src/play/main.ts`](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/play/main.ts) (Playground)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["iPhone Capture"]
  node_capture_app["Capture App"]
  node_capture_controller["Capture Session"]
  node_coverage["Photo Coverage"]
  node_capture_view["Scan View<br/>[ScanView.swift]"]
  node_house_project["House Project<br/>[HouseProject.swift]"]
  node_scan_bundle["Scan Bundle<br/>[ScanBundle.swift]"]
  node_scan_mesh["PLY Mesh<br/>[PLYMesh.swift]"]
end

subgraph group_reconstruction["Reconstruction Workflow"]
  node_agent(("Coding Agent"))
  node_skill["Scan-to-Three.js Skill<br/>[SKILL.md]"]
  node_room_export["Room Export"]
end

subgraph group_viewer["Room Viewer"]
  node_viewer_entry["Viewer Entry<br/>[main.ts]"]
  node_room_assets["Room Assets<br/>[asset-base.ts]"]
  node_knolling["Knolling View<br/>[knolling.ts]"]
  node_layout_view["Layout View<br/>[layout.ts]"]
  node_play_entry["Playground<br/>[main.ts]"]
end

subgraph group_runtime["Rendering Runtime"]
  node_room_types["Room Contract<br/>[types.ts]"]
  node_materials["Materials<br/>[materials.ts]"]
  node_lighting["Lighting<br/>[lighting.ts]"]
  node_rendering["Render Pipeline<br/>[render.ts]"]
end

subgraph group_physics["Interactive Physics"]
  node_physics["Room Physics<br/>[physics.ts]"]
  node_player["Player Controller<br/>[player.ts]"]
  node_interaction["Object Interaction<br/>[interact.ts]"]
  node_physics_tags["Physics Tagging<br/>[tagging.ts]"]
end

node_iphone_user(("iPhone User"))
node_viewer_user(("Viewer User"))

node_iphone_user -->|"scans rooms"| node_capture_app
node_capture_app -.->|"records evidence"| node_capture_controller
node_capture_controller -->|"scores coverage"| node_coverage
node_capture_controller -->|"updates view"| node_capture_view
node_capture_controller -->|"saves project"| node_house_project
node_capture_controller -->|"writes bundle"| node_scan_bundle
node_agent -->|"uses skill"| node_skill
node_iphone_user -->|"exports session"| node_room_export
node_room_export -->|"provides scan"| node_skill
node_skill -->|"guides modeling"| node_agent
node_agent -->|"compares renders"| node_viewer_entry
node_viewer_user -->|"explores rooms"| node_viewer_entry
node_viewer_entry -->|"resolves assets"| node_room_assets
node_viewer_entry -->|"collects inventory"| node_knolling
node_viewer_entry -->|"shows layout"| node_layout_view
node_viewer_entry -->|"prepares rendering"| node_rendering
node_viewer_entry -->|"configures rendering"| node_lighting
node_viewer_entry -->|"uses materials"| node_materials
node_play_entry -->|"builds simulation"| node_physics
node_play_entry -->|"uses renderer"| node_rendering
node_play_entry -->|"sets lighting"| node_lighting
node_play_entry -->|"uses materials"| node_materials
node_physics -->|"accepts room"| node_room_types
node_physics -->|"reads tags"| node_physics_tags
node_player -->|"uses simulation"| node_physics
node_interaction -->|"uses simulation"| node_physics
node_interaction -->|"uses controller"| node_player
node_rendering -->|"uses lighting"| node_lighting

click node_capture_app "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/HouseCaptureApp.swift"
click node_capture_controller "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/CaptureController.swift"
click node_coverage "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/CoverageEngine.swift"
click node_capture_view "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/ScanView.swift"
click node_house_project "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/HouseProject.swift"
click node_scan_bundle "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/ScanBundle.swift"
click node_scan_mesh "https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/PLYMesh.swift"
click node_skill "https://github.com/wesbos/3d-model-anything/blob/main/.agents/skills/scan-to-threejs/SKILL.md"
click node_viewer_entry "https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/main.ts"
click node_room_assets "https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/asset-base.ts"
click node_knolling "https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/knolling.ts"
click node_layout_view "https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/layout.ts"
click node_play_entry "https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/play/main.ts"
click node_room_types "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/types.ts"
click node_materials "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/materials.ts"
click node_lighting "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/lighting.ts"
click node_rendering "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/render.ts"
click node_physics "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/physics.ts"
click node_player "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/player.ts"
click node_interaction "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/interact.ts"
click node_physics_tags "https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/tagging.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_capture_app,node_capture_controller,node_coverage,node_capture_view,node_house_project,node_scan_bundle,node_scan_mesh,node_iphone_user,node_viewer_user toneBlue
class node_agent,node_skill,node_room_export toneAmber
class node_viewer_entry,node_room_assets,node_knolling,node_layout_view,node_play_entry toneMint
class node_room_types,node_materials,node_lighting,node_rendering toneRose
class node_physics,node_player,node_interaction,node_physics_tags toneIndigo
```

## Components

### iPhone Capture

- [Capture App](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/HouseCaptureApp.swift): `apps/house-capture/HouseCapture/HouseCaptureApp.swift`
- [Capture Session](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/CaptureController.swift): `apps/house-capture/HouseCapture/CaptureController.swift`
- [Photo Coverage](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/CoverageEngine.swift): `apps/house-capture/HouseCapture/CoverageEngine.swift`
- [Scan View](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/ScanView.swift): `apps/house-capture/HouseCapture/ScanView.swift`
- [House Project](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/HouseProject.swift): `apps/house-capture/HouseCapture/HouseProject.swift`
- [Scan Bundle](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/ScanBundle.swift): `apps/house-capture/HouseCapture/ScanBundle.swift`
- [PLY Mesh](https://github.com/wesbos/3d-model-anything/blob/main/apps/house-capture/HouseCapture/PLYMesh.swift): `apps/house-capture/HouseCapture/PLYMesh.swift`

### Reconstruction Workflow

- **Coding Agent**
- [Scan-to-Three.js Skill](https://github.com/wesbos/3d-model-anything/blob/main/.agents/skills/scan-to-threejs/SKILL.md): `.agents/skills/scan-to-threejs/SKILL.md`
- **Room Export**

### Room Viewer

- [Viewer Entry](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/main.ts): `apps/room-viewer/src/main.ts`
- [Room Assets](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/asset-base.ts): `apps/room-viewer/src/asset-base.ts`
- [Knolling View](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/knolling.ts): `apps/room-viewer/src/knolling.ts`
- [Layout View](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/layout.ts): `apps/room-viewer/src/layout.ts`
- [Playground](https://github.com/wesbos/3d-model-anything/blob/main/apps/room-viewer/src/play/main.ts): `apps/room-viewer/src/play/main.ts`

### Rendering Runtime

- [Room Contract](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/types.ts): `packages/room-runtime/types.ts`
- [Materials](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/materials.ts): `packages/room-runtime/materials.ts`
- [Lighting](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/lighting.ts): `packages/room-runtime/lighting.ts`
- [Render Pipeline](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-runtime/render.ts): `packages/room-runtime/render.ts`

### Interactive Physics

- [Room Physics](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/physics.ts): `packages/room-physics/physics.ts`
- [Player Controller](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/player.ts): `packages/room-physics/player.ts`
- [Object Interaction](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/interact.ts): `packages/room-physics/interact.ts`
- [Physics Tagging](https://github.com/wesbos/3d-model-anything/blob/main/packages/room-physics/tagging.ts): `packages/room-physics/tagging.ts`

### Other components

- **iPhone User**
- **Viewer User**

## Connections

- iPhone User → Capture App: scans rooms (evidence: `README.md`)
- Capture App → Capture Session: records evidence
- Capture Session → Photo Coverage: scores coverage (evidence: `apps/house-capture/HouseCapture/CaptureController.swift`)
- Capture Session → Scan View: updates view (evidence: `apps/house-capture/HouseCapture/CaptureController.swift`)
- Capture Session → House Project: saves project (evidence: `apps/house-capture/HouseCapture/CaptureController.swift`)
- Capture Session → Scan Bundle: writes bundle (evidence: `apps/house-capture/HouseCapture/CaptureController.swift`)
- Coding Agent → Scan-to-Three.js Skill: uses skill (evidence: `README.md`)
- iPhone User → Room Export: exports session (evidence: `README.md`)
- Room Export → Scan-to-Three.js Skill: provides scan (evidence: `README.md`)
- Scan-to-Three.js Skill → Coding Agent: guides modeling (evidence: `README.md`)
- Coding Agent → Viewer Entry: compares renders (evidence: `README.md`)
- Viewer User → Viewer Entry: explores rooms (evidence: `README.md`)
- Viewer Entry → Room Assets: resolves assets (evidence: `apps/room-viewer/src/main.ts`)
- Viewer Entry → Knolling View: collects inventory (evidence: `apps/room-viewer/src/main.ts`)
- Viewer Entry → Layout View: shows layout (evidence: `apps/room-viewer/src/main.ts`)
- Viewer Entry → Render Pipeline: prepares rendering (evidence: `apps/room-viewer/src/main.ts`)
- Viewer Entry → Lighting: configures rendering (evidence: `apps/room-viewer/src/main.ts`)
- Viewer Entry → Materials: uses materials (evidence: `apps/room-viewer/src/main.ts`)
- Playground → Room Physics: builds simulation (evidence: `apps/room-viewer/src/play/main.ts`)
- Playground → Render Pipeline: uses renderer (evidence: `apps/room-viewer/src/play/main.ts`)
- Playground → Lighting: sets lighting (evidence: `apps/room-viewer/src/play/main.ts`)
- Playground → Materials: uses materials (evidence: `apps/room-viewer/src/play/main.ts`)
- Room Physics → Room Contract: accepts room (evidence: `packages/room-physics/physics.ts`)
- Room Physics → Physics Tagging: reads tags (evidence: `packages/room-physics/physics.ts`)
- Player Controller → Room Physics: uses simulation (evidence: `packages/room-physics/player.ts`)
- Object Interaction → Room Physics: uses simulation (evidence: `packages/room-physics/interact.ts`)
- Object Interaction → Player Controller: uses controller (evidence: `packages/room-physics/interact.ts`)
- Render Pipeline → Lighting: uses lighting (evidence: `packages/room-runtime/render.ts`)
