# beginwithf/real-time-manim architecture

> Architecture diagram of the GitHub repository beginwithf/real-time-manim, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beginwithf/real-time-manim
- Repository: https://github.com/beginwithf/real-time-manim

## Overview

Real-Time-Manim is a Manim Community Edition renderer with a Python animation/window layer and a native Vulkan backend. The principal workflow is a Manim scene playing animations through MLWindow, dispatching mobjects to shape or text senders, crossing a ctypes boundary, and rendering frames through Vulkan. The product also supports offline and live video recording, broad animation families, and LaTeX SVG caching with media cleanup. Native details and recorder internals are only partly sampled; documented flows are cited to the README, and uncertain internal links are omitted.

Main entry points: [`real_time_manim/vulkan_bind.py`](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_bind.py) (MLWindow), [`native/vulkan_core.h`](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/vulkan_core.h) (Native rendering API), [`real_time_manim/vulkan_shapes.py`](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_shapes.py) (Shape dispatch), [`real_time_manim/vulkan_text.py`](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_text.py) (Text dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python runtime"]
  node_window["MLWindow<br/>[vulkan_bind.py]"]
  node_shape_sender["Shape dispatch<br/>[vulkan_shapes.py]"]
  node_text_sender["Text dispatch<br/>[vulkan_text.py]"]
  node_render_util["Render utilities<br/>[vulkan_util.py]"]
end

subgraph group_animation["Animation system"]
  node_anim["Animation engine<br/>[base.py]"]
  node_anim_catalog["Animation families"]
  node_rates["Rate functions<br/>[rate_functions.py]"]
end

subgraph group_native["Native renderer"]
  node_native_api["Native rendering API<br/>[vulkan_core.h]"]
  node_vertex_builders["Shape vertex builders"]
  node_font_raster["Font rasterizer<br/>[stb_truetype.h]"]
  node_platform["Window platform<br/>[platform.c]"]
  node_vulkan["Vulkan pipeline<br/>[vulkan_init.c]"]
end

subgraph group_capture["Recording and cache"]
  node_recorder["Scene recorders<br/>[record.py]"]
  node_ffmpeg["ffmpeg"]
  node_video["MP4 output"]
  node_tex_cache[("LaTeX cache<br/>[util.py]")]
  node_media["Manim media directory"]
end

node_scene(("Manim scene"))

node_scene -->|"binds and plays"| node_window
node_window -->|"runs animations"| node_anim
node_anim_catalog -->|"extends"| node_anim
node_anim -->|"applies timing"| node_rates
node_window -->|"dispatches shapes"| node_shape_sender
node_window -->|"dispatches text"| node_text_sender
node_shape_sender -->|"uses conversions"| node_render_util
node_text_sender -->|"uses conversions"| node_render_util
node_shape_sender -->|"calls via ctypes"| node_native_api
node_text_sender -->|"calls via ctypes"| node_native_api
node_native_api -->|"dispatches geometry"| node_vertex_builders
node_vertex_builders -->|"rasterizes glyphs"| node_font_raster
node_native_api -->|"uses platform layer"| node_platform
node_platform -->|"submits frames"| node_vulkan
node_vulkan -->|"presents frames"| node_scene
node_scene -->|"records scene"| node_recorder
node_recorder -->|"pipes frames"| node_ffmpeg
node_ffmpeg -->|"encodes video"| node_video
node_scene -->|"reuses compiled SVGs"| node_tex_cache
node_recorder -->|"cleans artifacts"| node_media

click node_window "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_bind.py"
click node_anim "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/animations/base.py"
click node_anim_catalog "https://github.com/beginwithf/real-time-manim/tree/C-version-clean/real_time_manim/animations"
click node_rates "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/rate_functions.py"
click node_shape_sender "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_shapes.py"
click node_text_sender "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_text.py"
click node_render_util "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_util.py"
click node_native_api "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/vulkan_core.h"
click node_vertex_builders "https://github.com/beginwithf/real-time-manim/tree/C-version-clean/native/draw"
click node_font_raster "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/stb_truetype.h"
click node_platform "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/platform.c"
click node_vulkan "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/vulkan_init.c"
click node_recorder "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/record.py"
click node_tex_cache "https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/util.py"

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_window,node_shape_sender,node_text_sender,node_render_util toneBlue
class node_anim,node_anim_catalog,node_rates toneAmber
class node_native_api,node_vertex_builders,node_font_raster,node_platform,node_vulkan toneMint
class node_recorder,node_ffmpeg,node_video,node_tex_cache,node_media toneRose
class node_scene toneIndigo
```

## Components

### Python runtime

- [MLWindow](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_bind.py): `real_time_manim/vulkan_bind.py`
- [Shape dispatch](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_shapes.py): `real_time_manim/vulkan_shapes.py`
- [Text dispatch](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_text.py): `real_time_manim/vulkan_text.py`
- [Render utilities](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/vulkan_util.py): `real_time_manim/vulkan_util.py`

### Animation system

- [Animation engine](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/animations/base.py): `real_time_manim/animations/base.py`
- [Animation families](https://github.com/beginwithf/real-time-manim/tree/C-version-clean/real_time_manim/animations): `real_time_manim/animations`
- [Rate functions](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/rate_functions.py): `real_time_manim/rate_functions.py`

### Native renderer

- [Native rendering API](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/vulkan_core.h): `native/vulkan_core.h`
- [Shape vertex builders](https://github.com/beginwithf/real-time-manim/tree/C-version-clean/native/draw): `native/draw`
- [Font rasterizer](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/stb_truetype.h): `native/stb_truetype.h`
- [Window platform](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/platform.c): `native/platform.c`
- [Vulkan pipeline](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/native/vulkan_init.c): `native/vulkan_init.c`

### Recording and cache

- [Scene recorders](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/record.py): `real_time_manim/record.py`
- **ffmpeg**
- **MP4 output**
- [LaTeX cache](https://github.com/beginwithf/real-time-manim/blob/C-version-clean/real_time_manim/util.py): `real_time_manim/util.py`
- **Manim media directory**

### Other components

- **Manim scene**

## Connections

- Manim scene → MLWindow: binds and plays (evidence: `README.md`)
- MLWindow → Animation engine: runs animations (evidence: `README.md`)
- Animation families → Animation engine: extends (evidence: `real_time_manim/animations/__init__.py`)
- Animation engine → Rate functions: applies timing (evidence: `real_time_manim/animations/base.py`)
- MLWindow → Shape dispatch: dispatches shapes (evidence: `README.md`)
- MLWindow → Text dispatch: dispatches text (evidence: `README.md`)
- Shape dispatch → Render utilities: uses conversions (evidence: `real_time_manim/vulkan_shapes.py`)
- Text dispatch → Render utilities: uses conversions (evidence: `real_time_manim/vulkan_text.py`)
- Shape dispatch → Native rendering API: calls via ctypes (evidence: `README.md`)
- Text dispatch → Native rendering API: calls via ctypes (evidence: `README.md`)
- Native rendering API → Shape vertex builders: dispatches geometry (evidence: `README.md`)
- Shape vertex builders → Font rasterizer: rasterizes glyphs (evidence: `native/draw/draw_text.c`)
- Native rendering API → Window platform: uses platform layer (evidence: `native/platform.c`)
- Window platform → Vulkan pipeline: submits frames (evidence: `native/platform.c`)
- Vulkan pipeline → Manim scene: presents frames (evidence: `README.md`)
- Manim scene → Scene recorders: records scene (evidence: `README.md`)
- Scene recorders → ffmpeg: pipes frames (evidence: `README.md`)
- ffmpeg → MP4 output: encodes video (evidence: `README.md`)
- Manim scene → LaTeX cache: reuses compiled SVGs (evidence: `README.md`)
- Scene recorders → Manim media directory: cleans artifacts (evidence: `README.md`)
