An AI-powered system that generates 3D models in Blender from natural language descriptions using ReAct (Reasoning + Acting) architecture.
- Natural Language to 3D: Convert text descriptions into working Blender models
- ReAct Architecture: AI reasons through modeling approach before generating code
- Multi-LLM Pipeline: Uses Gemini 2.5 Pro for complex reasoning and Flash for validation
- Code Validation: Automatic syntax and logic checking before execution
- Error Recovery: Intelligent retry mechanism for failed generations
User Input → Prompt Preprocessing → ReAct Planner → Code Generation → Validation → 3D Model
↑ ↓
Error Feedback ←─────────────── Failed Validation
The system uses a multi-stage pipeline:
- Preprocessing: Converts natural language to technical specifications
- ReAct Planning: AI reasons through modeling steps before acting
- Code Generation: Gemini 2.5 Pro generates Blender Python code
- Validation: Gemini 2.5 Flash checks for errors and logical issues
- Execution: Clean code runs in Blender to create 3D models
- AI Models: Google Gemini 2.5 Pro & Flash
- 3D Software: Blender (Python API)
- Architecture: ReAct (Reasoning + Acting)
- Language: Python
- APIs: Blender Python API (bpy)
- Python 3.8+
- Blender 3.0+
- Google AI API key
- Required Python packages (see
requirements.txt)
from react_3d_generator import ModelGenerator
generator = ModelGenerator()
result = generator.generate("Create a medieval sword")
if result.success:
print(f"Model generated successfully: {result.model_path}")
else:
print(f"Generation failed: {result.error}")python generate.py "Create a medieval sword with ornate handle"- "Create a medieval sword"
- "Generate a simple chair"
- "Make a coffee mug with handle"
- "Create a basic house structure"
react-3d-generator/
├── src/
│ ├── react_planner.py # ReAct reasoning logic
│ ├── code_generator.py # Gemini Pro integration
│ ├── validator.py # Gemini Flash validation
│ ├── blender_interface.py # Blender API wrapper
│ └── preprocessor.py # Input processing
├── examples/ # Example generated models
├── tests/ # Unit tests
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
└── README.md # This file
Input: "Create a medieval sword"
Reasoning Phase (Gemini 2.5 Pro):
Thought: To create a medieval sword, I need:
1. A blade - long cylinder, scaled and positioned
2. A handle - smaller cylinder below the blade
3. A crossguard - thin rectangular piece perpendicular to blade
4. A pommel - small sphere at the end of handle
Action: Generate Blender Python code for these components
Code Generation:
import bpy
# Create blade
bpy.ops.mesh.primitive_cylinder_add(radius=0.05, depth=1.5, location=(0, 0, 0.75))
blade = bpy.context.active_object
blade.name = "Sword_Blade"
# Create handle
bpy.ops.mesh.primitive_cylinder_add(radius=0.08, depth=0.3, location=(0, 0, -0.15))
handle = bpy.context.active_object
handle.name = "Sword_Handle"
# ... additional codeValidation Phase (Gemini 2.5 Flash):
- Checks syntax errors
- Validates bpy API usage
- Ensures logical object placement
- Verifies naming conventions
Create a config.py file:
GOOGLE_API_KEY="YOUR_API_KEY"
LANGCHAIN_API_KEY="YOUR_API_KEY"
LANGCHAIN_PROJECT="YOUR_API_KEY"
LANGCHAIN_TRACING_V2="YOUR_API_KEY"
LANGSMITH_TRACING="YOUR_API_KEY"
LANGSMITH_ENDPOINT="https://api.smith.langchain.com"- Basic geometric shapes only
- Limited material support
- Single-object generation (no assemblies)
- Local execution only
- Manual Blender setup required
- Web-based interface
- Real-time preview
- Advanced material generation
- Multi-part assemblies
- Asset library integration
- Texture generation
- Cloud deployment
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google AI for Gemini models
- Blender Foundation for the amazing 3D software
- ReAct paper authors for the reasoning framework
Anant Singh - anantsingh4444@gmail.com