Experimentalv3.5Tool • Python

RayLM

An LLM-powered orchestrator for creating POV-Ray 3D scenes and animations. RayLM leverages AI to automatically generate complex 3D scenes from text prompts, with built-in syntax verification and auto-repair capabilities.

🎨 AI-Powered 3D: Generate photorealistic 3D scenes and animations using natural language prompts. No manual modeling required!

See It In Action

Watch RayLM generate photorealistic 3D scenes from simple text prompts

How It Works

RayLM uses a multi-stage AI-powered workflow to generate and render POV-Ray scenes:

1

Code Generation

A generator LLM (default: Gemini 3 Pro) translates your text prompt into POV-Ray SDL (Scene Description Language) code, including camera, lighting, geometry, and materials.

2

Syntax Verification

A verifier LLM (default: Claude Sonnet 4.5) reviews the generated code for syntax errors, compliance with POV-Ray 3.7 standards, and structural correctness.

3

Rendering

POV-Ray renders the scene into an image or animation (using FFmpeg for video stitching).

4

Auto-Repair Loop

If rendering fails due to syntax errors, the verifier LLM automatically fixes the code and retries (up to 3 attempts).

Key Features

AI-Powered Scene Creation

Automatically generates complex 3D scenes without manual modeling using advanced LLMs.

Two-Step Generation

Separate generation and verification steps ensure coherent and well-structured scenes.

Animation Support

Generate animated sequences with FFmpeg integration for video stitching.

Auto-Repair

Automatic error detection and code fixing with up to 3 retry attempts.

Flexible Prompting

Accepts user prompts from command line or files, with support for random scene generation.

High-Quality Output

Creates photorealistic scenes with proper lighting, materials, and composition up to 4K resolution.

Requirements

Python 3.7+

Required for running the script

Zaguán API Key

Register at zaguanai.com to get your API key

POV-Ray Renderer (MANDATORY)

Download from github.com/POV-Ray/povray

FFmpeg (for animations)

Required for animation mode - ffmpeg.org

Installation

1. Install POV-Ray

# Follow official installation instructions for your OS
# Ensure 'povray' command is available in your PATH

2. Install FFmpeg (optional, for animations)

# Linux
sudo apt install ffmpeg

# macOS
brew install ffmpeg

# Windows: Download from https://ffmpeg.org

3. Install Python Dependencies

pip install openai python-dotenv

4. Set Up API Credentials

# Option 1: Environment variables
export ZAGUAN_API_KEY="your_api_key_here"
export ZAGUAN_BASE_URL="your_zaguan_base_url"  # Optional

# Option 2: Create .env file
echo "ZAGUAN_API_KEY=your_api_key_here" > .env
echo "ZAGUAN_BASE_URL=your_zaguan_base_url" >> .env

Usage Examples

Basic Scene Generation

python raylm3.5.py "A glass sphere on a checkered floor with dramatic lighting"

Generate Animation

python raylm3.5.py "Rotating crystal" --animation --frames 60

High-Quality 4K Render

python raylm3.5.py "Sunset over mountains" --width 3840 --height 2160 --quality 11

Load Prompt from File

python raylm3.5.py --prompt-file scene_description.txt

Generate Code Only (No Rendering)

python raylm3.5.py "Abstract geometric shapes" --no-render

Best Practices

Prompt Engineering

  • Be specific about materials, lighting, and composition
  • Mention camera angles and perspective
  • Include details about colors, textures, and atmosphere
  • For animations, describe the motion or transformation

Example of a Good Prompt

“A photorealistic scene of a crystal sphere floating above a marble pedestal in a dark room. The sphere should be transparent with internal reflections. Dramatic side lighting from a single point light source creates strong shadows. Camera angle is slightly below eye level, looking up at the sphere. The marble has subtle veining and a polished finish.”

Iterative Refinement

Start with simple scenes and gradually add complexity. Use the --no-render flag to quickly iterate on code generation before committing to full renders.

Start Creating 3D Scenes with AI

RayLM makes 3D scene creation accessible to everyone. No modeling experience required.