Repository navigation
Visualization System Scene Graph
The Scene Graph is the hierarchical tree of React components that dictates exactly what is rendered inside the React Three Fiber <Canvas>.
In declarative 3D (like R3F), the structure of the React tree directly mirrors the structure of the WebGL scene. A well-organized scene graph ensures that when the user switches from Architecture Explorer to Live Inference, memory is properly garbage collected and the scene is rebuilt deterministically.
TokenPrint uses components/SceneLoader.tsx as the primary boundary. Inside it, a single Scene component listens to the mode state in the Zustand store and mounts one of three main sub-scenes:
-
TensorCloud.tsx: A single highly optimizedTHREE.Pointsmesh. -
GenerationScene.tsx: A complex hierarchy containing theTransformerStack,KvCacheVolume, andSkyline. -
WalkthroughScene.tsx: A wrapper aroundTransformerStackthat controls chapter-specific highlighting and camera angles.
Components like the TransformerStack are reused across modes to ensure visual consistency. If a SwiGLU funnel is updated for Generation, it automatically updates for the Walkthrough.
flowchart TD
AppShell --> SceneLoader
SceneLoader --> Canvas[<Canvas>]
Canvas --> SceneRouter
SceneRouter -- Mode: Architecture --> TensorCloud
SceneRouter -- Mode: Generation --> GenScene
SceneRouter -- Mode: Walkthrough --> WalkScene
GenScene --> Stack[TransformerStack]
GenScene --> KV[KvCacheVolume]
WalkScene --> Stack
| Previous | Home | Next |
|---|---|---|
| Visualization System | Home | Geometry |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System