Skip to main content

Worldlock

3D-consistent video generation with persistent world geometry, dual-pass conditioning, and low-VRAM support.

Worldlock decouples 3D spatial structure from AI video synthesis. Instead of relying solely on text prompts—where objects warp, drift, or change proportions mid-spin—Worldlock renders a lightweight 3D world (trimesh + pyrender) to extract gamma-normalized depth maps and multi-channel color-ID edge maps, guiding AnimateDiff + ControlNet to render photorealistic, geometrically locked video clips even on 4 GB dedicated VRAM GPUs.


Key Features

  • Persistent 3D World State (WorldScene & SceneObject): Build scenes from primitives (add_box, add_ground_grid, add_slatted_crate) or import custom .glb, .gltf, and .obj models (load_mesh), animating individual objects independently of the background.
  • Dual-Pass Conditioning (ConditioningExtractor): Automatically switches between natural RGB lighting and high-contrast segmentation IDs to extract crisp, isoluminant-safe Canny wireframes alongside depth maps—eliminating double-edge artifacts on complex geometry.
  • Flexible Camera Trajectories (CameraPath): Supports stationary turntable cameras (CameraPath.static), circular camera orbits (CameraPath.orbit), and linear push-in moves (CameraPath.dolly).
  • 4 GB VRAM-First Rendering (WorldRenderer): Built-in sequential CPU offloading, VAE slicing, and FreeNoise sliding context windows (low_vram=True by default) prevent Windows shared-RAM bottlenecks and out-of-memory errors.

Installation

Install directly from PyPI (or in editable mode from source):

pip install worldlock

From Source (Development)

git clone https://github.com
cd worldlock
pip install -e ".[dev]"

Linux Headless Tip: If rendering on a headless Linux server without a display, install pyglet / OSMesa or EGL (sudo apt-get install libosmesa6-dev or set PYOPENGL_PLATFORM=egl).


Quickstart: Turntable Crate Spin

from worldlock import CameraPath, WorldRenderer, WorldScene

# 1. Build a persistent 3D world and animate the hero crate
scene = WorldScene()
scene.add_directional_light()
scene.add_ground_grid()

crate = scene.add_slatted_crate("hero_crate")
crate.animate_rotation(axis="y", degrees=180.0, num_frames=16)

# 2. Set up a fixed 3/4 camera looking at the center of the scene
camera = CameraPath.static(
    position=(1.8, 3.8, 4.1),
    target=(0.0, 0.0, 0.0),
    num_frames=16,
)

# 3. Render a 3D-consistent video (tuned for 4 GB+ dedicated VRAM)
renderer = WorldRenderer(low_vram=True)
video = renderer.render(
    scene=scene,
    camera_path=camera,
    prompt=(
        "RAW photo, an oak wooden slatted crate sitting in the center on granite tiles, "
        "bright daylight, crisp shadows, 8k uhd"
    ),
    negative_prompt="3d render, cgi, cartoon, blurry, distorted, morphing, flickering, warped",
)
video.save("worldlock_demo.mp4", fps=16)

Custom 3D Models & Orbiting Cameras

You can import any .glb or .obj asset and orbit the camera around it while keeping the background stationary:

from worldlock import CameraPath, ConditioningExtractor, WorldRenderer, WorldScene

scene = WorldScene()
scene.add_directional_light()
scene.add_ground_grid()

# Load your own 3D mesh
asset = scene.create_object("custom_asset").load_mesh("model.glb", scale=1.0)

# Orbit the camera 180 degrees around the object
camera = CameraPath.orbit(
    center=(0.0, 0.0, 0.0),
    radius=4.5,
    height=2.8,
    degrees=180.0,
    num_frames=16,
)

# Optional: Inspect or save Depth & Canny conditioning maps before running diffusion
extractor = ConditioningExtractor(width=512, height=512)
conditioning = extractor.extract(scene, camera, save_dir="scene_frames")

renderer = WorldRenderer(low_vram=True)
video = renderer.render_from_conditioning(
    conditioning=conditioning,
    prompt="RAW photo, weathered bronze sculpture in a sunlit stone courtyard, 8k uhd",
)
video.save("orbit_demo.mp4", fps=16)

Architecture Overview

Module Class Responsibility
worldlock.scene WorldScene, SceneObject Manages 3D geometry, directional lights, per-object transforms, and dual-pass materials.
worldlock.camera CameraPath Computes orthonormal OpenGL camera poses for static, orbit, and dolly trajectories.
worldlock.conditioning ConditioningExtractor Renders offscreen depth maps, multi-channel ID Canny edges, and base RGB sequences.
worldlock.renderer WorldRenderer Runs AnimateDiff + dual ControlNet (Depth + Canny) with low-VRAM memory optimizations.

License

MIT License. See LICENSE for details.

Metadata

Release files for worldlock 0.1.0

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

Source distribution (sdist)

Source distribution for worldlock 0.1.0
File Size Uploaded Provenance Actions
worldlock-0.1.0.tar.gz 117.8 kB Without provenance Details for worldlock-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for worldlock 0.1.0
File Interpreter ABI Platform Actions
worldlock-0.1.0-py3-none-any.whl Python 3 none any Details for worldlock-0.1.0-py3-none-any.whl

Total release size: 132.3 kB

Release files / worldlock-0.1.0.tar.gz

Download URL worldlock-0.1.0.tar.gz
Size 117.8 kB
Tags Source
SHA-256 checksum
How to use checksums
08ba506c57c45ac7d471dcd060c0a3165fb3db5d869f1088757ffbe921c684ca
BLAKE2b-256 checksum
How to use checksums
d2c4575e5c4dee8360fe3081140c67f31c64b9c6eafe05b22910f4ca8df65eb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / worldlock-0.1.0-py3-none-any.whl

Download URL worldlock-0.1.0-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d001d5b229726347021bb0b61414edf274a718d5a8f6c3c47274a0bc8d4e894
BLAKE2b-256 checksum
How to use checksums
858c881a11ec4909d9b7eb2936f7b2695f2bdf761565eced193cef1f3af2cc47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for worldlock 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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