Skip to main content

Renderer Overview

ManimVTK supports three rendering backends, each optimized for different use cases:

Cairo

2D Vector Graphics Best for 2D animations and diagrams

OpenGL

3D Hardware Acceleration Fast real-time 3D rendering

VTK

Scientific Visualization High-quality 3D with VTK export

Selecting a Renderer

Via Command Line

# Cairo (default)
manimvtk -pqh scene.py MyScene

# OpenGL
manimvtk -pqh scene.py MyScene --renderer opengl

# VTK
manimvtk -pqh scene.py MyScene --renderer vtk

Via Configuration

In manim.cfg:
[CLI]
renderer = vtk

Cairo Renderer

The default renderer, based on the Cairo graphics library.

Characteristics

  • Excellent 2D quality: Sharp vector graphics
  • Text rendering: High-quality text and LaTeX
  • Mature and stable: Well-tested, minimal bugs
  • ⚠️ 2D focused: Basic 3D support only
  • ⚠️ CPU-based: No GPU acceleration

Best For

  • 2D mathematical animations
  • Educational diagrams
  • Text-heavy content
  • Precise vector graphics

Example

from manimvtk import *

class CairoExample(Scene):
    def construct(self):
        # Perfect for 2D
        equation = MathTex(r"e^{i\pi} + 1 = 0")
        self.play(Write(equation))
        self.wait()
# Render with Cairo (default)
manimvtk -pqh scene.py CairoExample

OpenGL Renderer

Hardware-accelerated rendering using OpenGL.

Characteristics

  • Fast: GPU-accelerated
  • Real-time preview: Interactive viewing
  • 3D support: Good 3D capabilities
  • ⚠️ Less mature: May have edge cases
  • ⚠️ Platform-dependent: Requires OpenGL drivers

Best For

  • Interactive development
  • Real-time previews
  • 3D animations (lighter-weight than VTK)
  • Fast iteration

Example

from manimvtk import *

class OpenGLExample(ThreeDScene):
    def construct(self):
        sphere = Sphere()
        self.set_camera_orientation(phi=60 * DEGREES)
        self.play(Create(sphere))
        self.wait()
# Render with OpenGL
manimvtk -pqh scene.py OpenGLExample --renderer opengl

VTK Renderer

Scientific visualization renderer with VTK export capabilities.

Characteristics

  • Scientific quality: Publication-grade 3D
  • VTK export: Export to .vtp, .vtm, .pvd formats
  • Advanced lighting: Realistic shading
  • ParaView integration: Direct export to ParaView
  • ⚠️ Slower startup: VTK initialization overhead
  • ⚠️ 3D focused: Best for 3D content

Best For

  • Scientific visualization
  • 3D surfaces and meshes
  • CFD/FEA visualization
  • ParaView workflows
  • High-quality 3D renders

Example

from manimvtk import *
import numpy as np

class VTKExample(ThreeDScene):
    def construct(self):
        surface = Surface(
            lambda u, v: np.array([u, v, np.sin(u) * np.cos(v)]),
            u_range=[-2, 2],
            v_range=[-2, 2],
            resolution=(50, 50)
        )
        surface.set_color_by_gradient(BLUE, RED)
        
        self.set_camera_orientation(phi=60 * DEGREES)
        self.play(Create(surface))
        self.wait()
# Render with VTK and export
manimvtk -pqh scene.py VTKExample --renderer vtk --vtk-export

VTK Renderer Guide

Detailed guide on VTK renderer features

Renderer Comparison

FeatureCairoOpenGLVTK
2D Quality⭐⭐⭐⭐⭐⭐⭐
3D Quality⭐⭐⭐⭐⭐
Performance⭐⭐⭐⭐⭐⭐⭐
Text/LaTeX⭐⭐⭐⭐⭐⭐⭐
Stability⭐⭐⭐⭐⭐⭐⭐⭐
Export FormatsImage/VideoImage/VideoVTK Files
GPU Acceleration
Scientific Use⭐⭐⭐⭐⭐

Choosing the Right Renderer

Decision Tree

Are you creating 2D content?
├─ Yes → Use Cairo
└─ No (3D content)
    ├─ Need VTK export?
    │  └─ Yes → Use VTK
    └─ Need fast preview?
       ├─ Yes → Use OpenGL
       └─ Need highest quality → Use VTK

Use Cases

  • Educational Videos
  • Scientific Visualization
  • 3D Showcases
  • Development/Testing
Recommendation: CairoMost educational content is 2D:
  • Equations and text
  • 2D graphs
  • Geometric diagrams
manimvtk -pqh lesson.py Lecture

Renderer-Specific Features

Cairo Only

  • Precise 2D rendering: Perfect for diagrams
  • Text shaping: Advanced typography
  • SVG-like quality: Clean vector output

OpenGL Only

  • Interactive preview: Real-time interaction
  • Fast rendering: GPU acceleration
  • Window mode: Live preview window

VTK Only

  • VTK file export: .vtp, .vtm, .pvd formats
  • Scientific data: Scalar/vector fields
  • Advanced shading: Physically-based rendering
  • ParaView compatibility: Direct export

Switching Renderers

You can use different renderers for the same scene:
class UniversalScene(ThreeDScene):
    def construct(self):
        sphere = Sphere()
        self.set_camera_orientation(phi=60 * DEGREES)
        self.play(Create(sphere))
        self.wait()
# Test with OpenGL (fast)
manimvtk -ql scene.py UniversalScene --renderer opengl

# Final render with VTK (quality)
manimvtk -qh scene.py UniversalScene --renderer vtk --vtk-export

# Alternative with Cairo (if 2D is enough)
manimvtk -qh scene.py UniversalScene

Performance Considerations

Cairo

  • Startup: Fast
  • Rendering: Moderate (CPU-bound)
  • Memory: Low to moderate
  • Best for: Small to medium 2D scenes

OpenGL

  • Startup: Moderate
  • Rendering: Fast (GPU-accelerated)
  • Memory: Moderate
  • Best for: Large 3D scenes, development

VTK

  • Startup: Slow (VTK initialization)
  • Rendering: Moderate to slow
  • Memory: Higher (complex meshes)
  • Best for: Final quality renders, export

Troubleshooting

Cause: OpenGL drivers not availableSolution:
# On headless servers
xvfb-run -a manimvtk -pqh scene.py MyScene --renderer opengl

# Or use Cairo/VTK instead
manimvtk -pqh scene.py MyScene --renderer cairo
Cause: VTK not installedSolution:
pip install vtk
# Or reinstall with VTK extras
pip install manimvtk[vtk]
Cause: Cairo is optimized for 2DSolution: Switch to VTK or OpenGL for 3D:
manimvtk -pqh scene.py MyScene --renderer vtk
Cause: Complex geometry or wrong rendererSolution:
  • Use lower quality for testing: -ql
  • Use OpenGL for faster preview
  • Reduce geometry resolution

Best Practices

# Testing - fast
manimvtk -ql scene.py Test --renderer opengl

# Final 2D - quality
manimvtk -qh scene.py Final

# Final 3D with export - quality + export
manimvtk -qh scene.py Final --renderer vtk --vtk-export
Most code works across all renderers:
# This works with any renderer
class AgnosticScene(Scene):
    def construct(self):
        circle = Circle()
        self.play(Create(circle))
Verify your scene works across renderers:
manimvtk -ql scene.py Test --renderer cairo
manimvtk -ql scene.py Test --renderer opengl
manimvtk -ql scene.py Test --renderer vtk

Next Steps