High-performance Lottie animation rendering for Godot Engine 4.3+ using optimized ThorVG backend.
Lottie animations running at 146 FPS with ThorVG's software render optimized multi-threaded rendering
Note: this is an integration demo for personal use, so features may fail/be incomplete and may not perform as expected.
- Ready-to-use LottieAnimation: Drop-in Godot node for seamless Lottie integration in your scenes
- Hybrid CPU-GPU rendering: ThorVG rasterizes vector data to RGBA8888 format in CPU memory, then converts to RGB texture for Godot's draw system
- Multi-threaded rendering: Parallel processing using all available CPU cores
- SIMD optimizations: AVX/SSE (x86/x64) or NEON (ARM) vectorization
- Smart rendering: Automatic partial rendering optimizations
- Lottie-focused: Optimized build with only necessary loaders
- Cross-platform: Windows, Linux, and macOS support
Want to test without building? The demo/ folder contains a ready-to-run Godot project with pre-built binaries for Windows x64:
- Open
demo/project.godotin Godot Engine 4.3+ - Enable the plugin: Go to Project → Project Settings → Plugins and enable "Godot Lottie"
- Run immediately - no compilation required!
- Test multiple Lottie animations and performance demos
Note: For Linux and macOS, you'll need to build the extension first (see Installation section below).
- Python 3.7+ with pip
- Git
- C++ Compiler:
- Windows: Visual Studio 2019+ or Build Tools
- Linux: GCC 8+ or Clang 10+
- macOS: Xcode Command Line Tools
git clone https://github.com/Kyooz/thorvg-godot.git
cd thorvg-godot
git submodule update --init --recursiveFrom the project root directory (thorvg-godot/):
All platforms:
pip install meson ninjaNote: On Windows, Meson and Ninja will be automatically added to your PATH by the build script if not already installed.
From the project root directory (thorvg-godot/):
Option A: Automated Build (Recommended)
Windows:
build_thorvg.batLinux/macOS:
./build_thorvg.shOption B: Manual Build (ThorVG Standard Process)
If you prefer to build ThorVG manually with custom options.
From the project root directory (thorvg-godot/):
Windows:
cd thirdparty/thorvg
python -m meson setup builddir -Dbuildtype=release -Dsimd=true -Dthreads=true -Dloaders=lottie -Dbindings=capi
python -m meson compile -C builddir
cd ../..Linux/macOS:
cd thirdparty/thorvg
python3 -m meson setup builddir -Dbuildtype=release -Ddefault_library=static -Dsimd=true -Dthreads=true -Dloaders=lottie -Dbindings=capi
python3 -m meson compile -C builddir
cd ../..Additional ThorVG build options:
The automated scripts already include optimal settings. For manual builds, you can customize with these flags:
-Dengines=sw— Software renderer only (already enabled)-Dbindings=capi— C API bindings (required, already enabled)-Ddefault_library=static— Static library build (Linux/macOS default)-Ddefault_library=shared— Shared library build (Windows default)-Dtests=false— Disable tests and examples-Dpartial=true— Enable partial rendering optimizations (already enabled)-Doptimization=3— Maximum optimization level (already enabled)
Example custom build:
For development/debugging, you can build with custom options:
cd thirdparty/thorvg
# Step 1: Configure build with custom options
python3 -m meson setup builddir \
-Dbuildtype=debugoptimized \
-Ddefault_library=static \
-Dsimd=true \
-Dthreads=true \
-Dloaders=lottie \
-Dbindings=capi
# Step 2: Compile the library
python3 -m meson compile -C builddir
cd ../..From the project root directory (thorvg-godot/):
# Windows
python -m SCons platform=windows target=template_debug
python -m SCons platform=windows target=template_release
# Linux
python -m SCons platform=linux target=template_debug
python -m SCons platform=linux target=template_release
# macOS
python -m SCons platform=macos target=template_debug
python -m SCons platform=macos target=template_releaseNote: On Windows, the build automatically copies
thorvg-1.dllto the addon's bin directory. Linux and macOS use static linking and don't require runtime libraries.
The build system configures ThorVG with the following optimizations:
- SIMD: Automatic detection and enablement of CPU vectorization
- Multi-threading: Task scheduler with configurable worker threads
- Partial rendering: Smart rendering optimizations
- Lottie loader only: Minimal build excluding unnecessary formats
- Release mode: Maximum compiler optimizations
The integration uses a hybrid CPU-GPU rendering approach:
- Vector Processing: ThorVG parses Lottie JSON and builds internal vector representation
- CPU Rasterization: ThorVG software renderer rasterizes vectors to ARGB pixel buffer using CPU with SIMD optimizations
- Format Conversion: ARGB data is converted to RGBA format via optimized SIMD routines (SSSE3/NEON)
- GPU Upload: RGBA texture data is uploaded to Godot's rendering system via
ImageTexture - GPU Compositing: Godot handles final compositing, blending, and display using GPU shaders
This approach leverages ThorVG's optimized CPU vector processing while maintaining compatibility with Godot's rendering pipeline.
| Platform | Architecture | ThorVG Library | Compiler | Status |
|---|---|---|---|---|
| Windows | x86_64 | thorvg-1.dll (shared) | MSVC | ✓ Tested |
| Linux | x86_64 | libthorvg.a (static) | GCC/Clang | ⚠ Needs testing |
| macOS | x86_64/ARM64 | libthorvg.a (static) | Clang | ⚠ Needs testing |
thorvg-godot/
├── build_thorvg.bat # Windows build script
├── build_thorvg.sh # Linux/macOS build script
├── src/ # Extension source code
│ ├── lottie_animation.cpp # Main animation class
│ ├── lottie_animation.h # Header file
│ └── register_types.cpp # Godot registration
├── demo/ # Example project with plugin
│ └── addons/
│ └── godot_lottie/ # ← Plugin folder to copy to your project
└── thirdparty/ # Third-party dependencies
├── godot-cpp/ # Godot C++ bindings
└── thorvg/ # ThorVG vector graphics library
- Copy the plugin: Copy the
demo/addons/godot_lottie/folder to your Godot project'saddons/directory - Enable the plugin: Go to Project → Project Settings → Plugins and enable "Godot Lottie"
- Add LottieAnimation node: Add
LottieAnimationnodes to your scene - Set animation path: Set the
animation_pathproperty to your Lottie JSON file
Detailed API documentation for the provided nodes and resources is available in this repository. It includes the LottieAnimation node reference (properties, methods, signals) and usage examples in GDScript.
See: API.md for a complete and up-to-date reference.
- Use appropriate
render_sizevalues (avoid excessive resolution) - Enable
use_worker_threadfor better performance on multi-core systems - Consider frame caching for frequently used animations
- Adjust
engine_option(0=Default, 1=SmartRender) based on your needs - On web builds, disable worker threads for better compatibility
Meson not found (Windows): The build script will automatically install Meson if missing. If you encounter issues:
pip install --user meson ninja
# Restart terminal to reload PATHMeson not found (Linux/macOS):
pip3 install --user meson ninja
# Or use system package manager:
# Ubuntu/Debian: sudo apt install meson ninja-build
# macOS: brew install meson ninjaCompiler not found:
- Windows: Install Visual Studio Build Tools
- Linux:
sudo apt install build-essential - macOS:
xcode-select --install
Submodule errors:
git submodule update --init --recursive --forcePoor performance:
- Verify SIMD is enabled in build output
- Check that multi-threading is working
- Reduce render resolution if needed
Loading errors:
- Ensure Lottie files are valid JSON format
- Check file path accessibility
- Verify the plugin is properly enabled
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit changes:
git commit -m 'Add new feature' - Push to branch:
git push origin feature/new-feature - Submit a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
- ThorVG Team - High-performance vector graphics library
- Godot Engine - Open source game engine
- LottieFiles - vector animation library powered by ThorVG
