Real-Time-Manim(RTM)
RTM(Real-Time-Manim) is a vulkan-based manim renderer boosting manim speed, making live-rendering available and compatible for rendering manim. Previous manim render focusing on Opengl ang Cairo renderer is CPU-based, making graphic rendering extremely slow and live-interaction unfeasible. RTM uses a refactored render pipeline (see flow chart below) to make live-render available for math animation, preparing for further development of Manteraction(a app for live interaction manim video creation, animation, and interaction.)
Audience. This README is a short, user-facing guide. For the full picture — architecture, rendering internals, the animation system and building from source — see the Wiki.
Highlights
- Live window. Render Manim scenes in real time inside a
MLWindow, not just to a rendered file. - GPU backend. A bundled
vulkan_core.dllreplaces the Cairo/OpenGL raster path with a Vulkan vertex pipeline (rects, circles, lines, beziers, text, …). - One-line video capture.
fast_record_scene(...)records a scene to an MP4 — offline and windowless by default — andrecord_scene(...)records against a live window. Output defaults to~/Downloads. - Auto-cleanup. Transient
media/artefacts are removed for you after a run. - LaTeX caching.
Tex/MathTexscenes reuse compiled SVGs so unchanged math is never recompiled. - All Manim Animations Supported — everything mentioned in the "Animation" part in manim community is supported(we are going to support other features in the future).
Install
The library is currently published to TestPyPI. With any Python 3.11+ on Windows 10/11:
pip install --index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
real-time-manim
The wheel bundles everything you need to render (vulkan_core.dll and the
window icon), so no separate build step is required.
Prerequisites at runtime: a Vulkan-capable GPU/driver, and
ffmpegon yourPATHif you want to record video.
Quick start
Write a normal Manim Scene, open a window, and play. Then record it to
~/Downloads with a single call:
from manim import Scene, Square, BLUE
from real_time_manim.vulkan_bind import MLWindow, Create, Wait
from real_time_manim.record import fast_record_scene
class Hello(Scene):
def construct(self):
win = MLWindow(960, 540) # a real-time window opens
win.scene = self
sq = Square(side_length=1.5, color=BLUE).set_fill(BLUE, 0.6)
win.play(Create(sq), run_time=1.0)
win.play(Wait(0.5))
win.close()
fast_record_scene(Hello) # → C:\Users\<you>\Downloads\output.mp4
That's it — recording starts and stops around the scene automatically, and the
transient media/ folder is cleaned up afterwards.
Core concepts
MLWindow — the live renderer
MLWindow(w, h) opens a real-time Vulkan window. Inside a scene you bind it and
drive it with Manim animations:
render = MLWindow(1280, 720)
render.scene = scene # bind the Manim scene
render.play(Create(sq)) # play any supported animation
render.close()
render.play(...) takes the same animations and keyword arguments you would pass
to Manim's Scene.play (run_time, lag_ratio, rate_func, …).
Two recorders (real_time_manim.record)
| Function | Mode | Behaviour |
|---|---|---|
fast_record_scene(scene, out_path=None, *, fps=60, hidden=True, overwrite=True, cleanup=True) |
offline | Fast framebuffer readback piped straight to ffmpeg. No window by default; runs at full speed. |
record_scene(scene, out_path=None, *, fps=60, overwrite=True, cleanup=True) |
real-time | Captures a live, visible window in a background thread. |
Both accept a Scene subclass, a Scene instance, or a no-arg callable, and
return a dict {out_path, windows, files}. When out_path is omitted, output
lands at ~/Downloads/output.mp4 (a scene opening several windows gets
_part2, _part3, … suffixes). cleanup=True (default) deletes transient
manim media/ after the run; set cleanup=False to keep it.
fast_record_scene(MyScene) # ~/Downloads/output.mp4
fast_record_scene(MyScene, "preview.mp4") # current dir, or pass a full path
fast_record_scene(MyScene, fps=60, hidden=False) # show the window while capturing
record_scene(MyScene, "live.mp4", fps=30) # record against a live window
LaTeX cache helpers (real_time_manim.util)
Rendering MathTex/Tex compiles each formula to an SVG. Cache the results so
unchanged math is reused instead of recompiled on every run:
from real_time_manim.util import restore_tex_cache, save_tex_cache
restore_tex_cache("tex_cache") # before rendering: warm manim's SVG dir
# ... run your Tex scene(s) ...
save_tex_cache("tex_cache") # after: stash newly compiled SVGs
All helpers take explicit media_dir/tex_subdir, only_ext, overwrite,
dry_run and verbose knobs. clear_media() force-removes the transient media
folder (used automatically by the recorders).
Animations
Import animations from real_time_manim.vulkan_bind (they re-export the
real_time_manim.animations package):
from real_time_manim.vulkan_bind import (
Create, Write, Transform, ReplacementTransform,
FadeIn, FadeOut, FadeTransform, GrowFromCenter,
Rotate, Rotating, ...
)
Highlights across categories:
- Transforms —
Transform,ReplacementTransform,FadeTransform,TransformMatchingShapes,TransformMatchingTex - Drawing —
Create,Uncreate,DrawBorderThenFill,ShowIncreasingSubsets,SpiralIn - Fading —
FadeIn,FadeOut - Movement / scaling —
MoveToTarget,MoveAlongPath,GrowFromCenter,GrowFromEdge,GrowFromPoint,GrowArrow,SpinInFromNothing - Text —
Write,Unwrite,TypeWithCursor,UntypeWithCursor - Rotation —
Rotate,Rotating - Effects —
ApplyWave,Circumscribe,Indicate,ShowPassingFlash,Blink,Homotopy - Grouping / timing —
AnimationGroup,Succession
How it works (in brief)
flowchart LR
subgraph Python
SC[Manim Scene] --> W[MLWindow<br/>play / animate]
W --> D[type-dispatch<br/>_send per mobject]
end
D -- "ctypes FFI" --> DLL[vulkan_core.dll]
subgraph Native
DLL --> C[per-shape vertex builders<br/>rect / circle / line / text / bezier]
C --> VK[Vulkan instance · device · swapchain]
VK --> GPU[(GPU pipeline)]
end
W -- optional readback --> FF[ffmpeg]
FF --> MP4[(MP4)]
- A
Scenebuilds mobjects and callsMLWindow.play(...). - The Python layer traverses the mobject tree and dispatches each shape to a type-specific sender.
- Shapes cross a
ctypesboundary intovulkan_core.dll, which emits vertices and submits them to a Vulkan pipeline. - Each frame is presented to the window — and can optionally be read back and
piped to
ffmpegas an MP4.
Full details (frame lifecycle, coordinate system, animation internals, shape→DLL mapping, build steps) live in the Wiki.
Repository layout
real-time-manim/
├── real_time_manim/ # the Python package
│ ├── vulkan_bind.py # MLWindow + record hooks (main bridge)
│ ├── record.py # one-call recorders (fast / real-time)
│ ├── util.py # LaTeX cache + forced media cleanup
│ ├── vulkan_shapes.py # shape-specific senders
│ ├── vulkan_text.py # text / bezier rendering
│ ├── rate_functions.py # easing functions
│ ├── animations/ # ~40 animation modules
│ └── utils/
├── native/ # C/C++ Vulkan engine (vulkan_core.dll source)
├── logo.* # project logos
└── pyproject.toml
Documentation & Wiki
- Home — overview and navigation
- Architecture — layers and data flow
- Getting Started — install, run, record
- API Reference —
MLWindow, animations, recorders, cache helpers - Animation Reference — supported animations with runnable examples
- Recording — recorders in depth
- Math Rendering — LaTeX vs. native Unicode mode
- Building the DLL — compile
vulkan_core.dll - Internals — rendering pipeline, shape dispatch, design decisions
License
MIT © real-time-manim contributors.
Acknowledgments
- ManimCE — the mathematical animation engine
- stb_truetype — TrueType font rasterizer
- Vulkan — the graphics API
Release files for real-time-manim 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| real_time_manim-0.1.3.tar.gz | 347.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| real_time_manim-0.1.3-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
Total release size: 576.3 kB
Release files / real_time_manim-0.1.3.tar.gz
| Download URL | real_time_manim-0.1.3.tar.gz |
|---|---|
| Size | 347.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9828c090990635e869aa91f0b8b46ab9d887fd4b221890cb55ef63fc7c9ead93
|
|
BLAKE2b-256 checksum How to use checksums |
fc4c2f4d2df4e3afcab67c462f73d8169122a62dd740f0adf4dcbe8963e96edf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / real_time_manim-0.1.3-cp311-cp311-win_amd64.whl
| Download URL | real_time_manim-0.1.3-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 228.3 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a854bea21bf852be76f0e8229ee59a8921c38b9ce6dc5adec856a161cd5c9970
|
|
BLAKE2b-256 checksum How to use checksums |
bb5b5a5fdd7cd448b32fa4f40a30e2f3e5441519e62beafe18bcce9d50fb8a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|