Skip to main content

Real-Time-Manim (RTM)

Real-Time-Manim V2 banner

PyPI Python Platform Downloads License: MIT AI agents

A Vulkan-accelerated, real-time rendering backend for ManimCE. RTM drives ManimCE's own Mobject / Animation model through a native Vulkan pipeline, so the same scene can be watched live, seeked to any frame instantly, and recorded to MP4 several times faster than the default renderer.

Start here: the project website for demos and the interactive wiki graph, and the GitHub Wiki for the source-level walkthrough. 中文说明: README.zh-CN.md.

AI agents: start with RTM-Wiki/agent/README.md — the whole API condensed into one greppable reference, with gotchas.md, patterns.md and llms.txt.


Install

pip install real-time-manim
pip install "real-time-manim[typst]"   # optional: in-process Typst math backend

The wheel bundles the platform binary (vulkan_core.dll on Windows, vulkan_core.dylib on Apple Silicon); no native build step. You need a Vulkan GPU/driver, and ffmpeg on PATH to record. macOS also needs MoltenVK at runtime (brew install molten-vk); Intel Macs can build the dylib with bash native/build_mac.sh.


Quick start

from real_time_manim import Scene, Square, Create, Wait, BLUE, MLWindow
from real_time_manim.record import fast_record_scene

class Hello(Scene):
    def construct(self):
        win = MLWindow(960, 540)      # size is forced to 1920x1080
        win.scene = self              # required
        win.play(Create(Square(side_length=1.5, color=BLUE).set_fill(BLUE, 0.6)), run_time=1.0)
        win.play(Wait(0.5))
        win.close()                   # required: flushes and finishes the encoder

fast_record_scene(Hello)              # -> ~/Downloads/output.mp4

MLWindow is also a context manager: with MLWindow(...) as win: closes it on the way out.

No separate ManimCE install, and no import manim. RTM bundles ManimCE 0.21.0 and re-exports its whole namespace. Import real_time_manim — not manim — or class identity splits.


Three ways to output

output API notes
Live window MLWindow render and watch in real time; no file
MP4 fast_record_scene / record_scene hidden offline (fastest) or visible real-time; jobs=N splits frames
PNG frames FrameServer / FramePreview any frame at any t in O(1), or scrub the timeline
from real_time_manim import MLWindow, Square, Create, FrameServer, FramePreview
from real_time_manim.record import fast_record_scene, record_scene

# 1. Live window
win = MLWindow(1920, 1080)
win.scene = MyScene()
win.play(Create(Square()), run_time=1.0)
win.close()

# 2. MP4: hidden/offline (fastest), parallel, or visible/real-time
fast_record_scene(MyScene)
fast_record_scene(MyScene, "out.mp4", jobs=4)
record_scene(MyScene, "live.mp4")

# 3. PNG frames: one frame, a list of times, or interactive scrubbing
fs = FrameServer(MyScene)
fs.save_frame(2.5, "frame.png")
fs.export_frames("frames/", [0.0, 1.5, 3.0])
fs.close()
FramePreview(MyScene).run()

The recorders accept a Scene subclass / instance / no-arg callable and return {out_path, windows, files, with_audio}. jobs="auto" splits only for an importable single-window scene of at least 240 frames; move expensive pure setup into prepare() so every worker shares it.


Highlights

  • Real-time window — 1920x1080 @ 60 fps, no export step.
  • Fast recording — around 1.9-2.8x faster than ManimCE Cairo. Static roots are baked into one texture per play; a Wait is encoded without redrawing the scene.
  • Parallel frames — jobs="auto" splits a long scene across workers; prepare() / shared_prepare() keep expensive setup from being repeated.
  • Frame-accurate seeking — any frame of a prepared scene in O(1), via FrameServer / FramePreview.
  • Depth-tested 3D — MeshMobject / MeshBatch / MeshGroup use a GPU depth buffer, so intersecting and self-occluding surfaces resolve per pixel.
  • Lighting — CPU-baked Manim shading (shade=True) or a native material (lit=True + win.set_mesh_light(...)).
  • Post-processing — optional native bloom and ACES/Reinhard tonemapping.
  • Full ManimCE — existing scenes run unchanged, including from manim import ... code.
  • Math without LaTeX — MathTex routes to an in-process Typst backend (RTM_TYPST=0 disables it).

New in 2.0.13: documentation refresh — a redesigned package page, a Chinese README, and the recovered pull-request history in PR_HISTORY.md. No engine changes: native/ is identical to 2.0.12, and real_time_manim/ differs only in the version fallback.


3D and post-processing

MeshMobject is a real Manim mobject, so shift, rotate and .animate move the mesh:

import numpy as np
from real_time_manim import (
    ThreeDScene, Surface, MeshMobject, BLUE, UP, DEGREES, MLWindow,
)

class Terrain(ThreeDScene):
    def construct(self):
        win = MLWindow(1920, 1080)
        win.scene = self
        self.set_camera_orientation(phi=60 * DEGREES, theta=-45 * DEGREES)
        surf = Surface(
            lambda u, v: np.array([u, v, 0.35 * np.sin(2 * u) * np.cos(2 * v)]),
            u_range=(-2, 2), v_range=(-2, 2), resolution=(48, 48), fill_color=BLUE,
        ).set_stroke(width=0)
        mesh = MeshMobject.from_surface(surf, shade=True)
        self.add(mesh)
        win.play(mesh.animate.shift(0.4 * UP), run_time=1.0)
        win.close()
  • Static mesh: win.set_mesh(MeshBatch.from_surface(surf)) after surf.set_shade_in_3d(False). It is a world-space snapshot; do not add the surface too.
  • Native material: MeshMobject.from_surface(surf, lit=True) plus win.set_mesh_light(ambient=0.25, diffuse=0.9, specular=0.4, shininess=48). shade=True and lit=True are mutually exclusive.
  • Bloom/tonemap: win.set_post(bloom=0.8, threshold=0.75, tonemap="aces"); set_post(False) disables it, RTM_POST=1 enables it everywhere.
  • from_surface() bakes opaque quads only; the mesh has no per-pixel transparency sort. MeshBatch.MAX_QUADS = 131072, one native mesh per frame.

Constraints

  • Output is fixed at 1920x1080 @ 60 fps; other values are corrected with a [rtm] forcing ... line.
  • One window per process; win.scene = self and win.close() are required (atexit is only a best-effort fallback and cannot report encoder errors).
  • There is no manim CLI — RTM is a library: MLWindow, the recorders, FrameServer, FramePreview, Timeline.

Contact

Bug reports and feature requests: open an issue. Email: axioviva@gmail.com.


License

MIT. ManimCE, Vulkan and Typst belong to their respective projects.

Metadata

Release files for real-time-manim 2.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for real-time-manim 2.0.13
File Size Uploaded Provenance Actions
real_time_manim-2.0.13.tar.gz 1.4 MB Without provenance Details for real_time_manim-2.0.13.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for real-time-manim 2.0.13
File Interpreter ABI Platform Actions
real_time_manim-2.0.13-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for real_time_manim-2.0.13-py3-none-win_amd64.whl
real_time_manim-2.0.13-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for real_time_manim-2.0.13-py3-none-macosx_12_0_arm64.whl

Total release size: 3.8 MB

Release files / real_time_manim-2.0.13.tar.gz

Download URL real_time_manim-2.0.13.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f9f6a461efccd14f8aa57de134a6cc8c001b3de2df5f17960e092cbae1e985e9
BLAKE2b-256 checksum
How to use checksums
e824a0b6303ac0480c925c6daf9a53b5b6fd5b75e23775dad01e9112fc2fb6dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / real_time_manim-2.0.13-py3-none-win_amd64.whl

Download URL real_time_manim-2.0.13-py3-none-win_amd64.whl
Size 1.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
002094b6d5384a5577baf9a82cb74ec5077a8a236bb44d62aa0fc710d66c48b7
BLAKE2b-256 checksum
How to use checksums
62b2c330732a1eb0c52185c491e9ee22a777923ef7fa5b8156389dc6014ff0f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Release files / real_time_manim-2.0.13-py3-none-macosx_12_0_arm64.whl

Download URL real_time_manim-2.0.13-py3-none-macosx_12_0_arm64.whl
Size 1.2 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
1db0aaeae2d0b0ed60983b72d0dfb12c50901089b9e1203926d7820a670bda43
BLAKE2b-256 checksum
How to use checksums
54cc8e7206e52afa13220d43445952a3800a41e3d57820a7ebe216df01c7d148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.4

Security for real-time-manim 2.0.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page