venkat112/venkat_glb_creation
GLB Generation Engine
An AI-driven GLB Generation Engine with an integrated UI workflow that transforms text descriptions into complete 3D worlds.
Features
- Natural Language Processing: Parse text descriptions and automatically generate 3D scenes
- Complete Scene Generation: Creates GLB files with meshes, materials, lighting, avatars, animations, audio, and effects
- Dual Generation Methods: Supports both Three.js and Blender Python generation
- Comprehensive Output: Generates scene graph JSON, generation code, and debug reports
- Modern UI: Beautiful web interface for uploading descriptions and downloading results
- PBR Materials: Realistic physically-based rendering materials
- Advanced Features: Supports fog, particles, emissive materials, animations, and spatial audio
Quick Start
Prerequisites
- Node.js (v18+ recommended)
- Blender (optional, for Blender-based generation)
- Install Blender on your machine
- On Windows, set the
BLENDER_PATHenvironment variable:
$env:BLENDER_PATH = "C:\Program Files\Blender Foundation\Blender 3.6\blender.exe"Installation
npm installThis will install:
- Express (web server)
- Three.js (for GLB generation)
- GLTF Transform (for GLB processing)
- Multer (for file uploads)
- UUID (for unique IDs)
Running the Server
node server.jsOr on Windows PowerShell:
.\start-server.ps1The server will start on http://localhost:3000
Usage
Web UI
- Open
http://localhost:3000in your browser - Enter a scene description in the text area, for example:
Create a magical forest at night with glowing mushrooms, fog, fireflies,
a walking wizard avatar, blue ambient light, and soft background music.- Click "Generate GLB"
- Wait for generation to complete
- Download the generated files:
scene.glb- The 3D scene filescene-graph.json- Structured scene graphgeneration-code.js- Three.js generation codegeneration-script.py- Blender Python scriptdebug-report.txt- Comprehensive debug report
API Usage
POST /generate
Generate a GLB from a text description or structured JSON.
Text Description:
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{"description": "Create a magical forest at night with glowing mushrooms"}'Structured JSON:
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d @example_scene.jsonResponse:
{
"success": true,
"sceneName": "generated_scene",
"id": "uuid-here",
"files": {
"glb": "/download/uuid/scene.glb",
"sceneGraph": "/download/uuid/scene-graph.json",
"codeJS": "/download/uuid/generation-code.js",
"codePy": "/download/uuid/generation-script.py",
"debug": "/download/uuid/debug-report.txt"
},
"summary": {
"nodes": 15,
"meshes": 8,
"materials": 5,
"lights": 2,
"hasAvatar": true,
"hasAudio": true,
"hasEffects": true
}
}GET /download/:id/:filename
Download generated files.
curl http://localhost:3000/download/uuid/scene.glb -o scene.glbScene Description Examples
Magical Forest
Create a magical forest at night with glowing mushrooms, fog, fireflies,
a walking wizard avatar, blue ambient light, and soft background music.Beach Scene
Create a sunny beach with palm trees, ocean water, sand, and a bright sun.Sci-Fi Lab
Create a futuristic laboratory with metallic surfaces, bright lights,
and a character standing in the center.Desert Scene
Create a desert at sunset with sand dunes, rocks, and warm orange lighting.Supported Features
Environments
- Forest, Beach, Desert, City, Lab, Room, Space, Underwater, Magical
Objects
- Trees, Mushrooms, Fire, Rocks, Water, Buildings, Vehicles, Fireflies
Lighting
- Day, Night, Sunset, Sunrise, Indoor
- Ambient, Directional, Point, Spot lights
- Custom colors and intensities
Materials
- Metal, Wood, Glass, Fabric, Stone
- Glowing/Emissive materials
- PBR (Physically Based Rendering)
Effects
- Fog, Rain, Snow, Bloom, Particles
Audio
- Ambient background music
- Spatial/positional audio
Avatars
- Humanoid avatars with rigging
- Walking, standing, sitting animations
- Customizable scale and position
Project Structure
glb_creation/
├── server.js # Express server with API endpoints
├── public/
├── scripts/
├── tmp/ # Generated files (temporary)
├── package.json
└── README.mdGeneration Pipeline
- Parse Description: Text description → Structured scene data
- Generate Scene Graph: Scene data → Scene graph JSON
- Generate GLB:
- Try Three.js generation first
- Fallback to Blender if Three.js fails
- Generate Code: Create Node.js and Python generation scripts
- Generate Debug Report: Comprehensive analysis and recommendations
- Return Files: All files available for download
API Endpoints
GET /- Web UIGET /api/status- API status and capabilitiesPOST /generate- Generate GLB from descriptionGET /download/:id/:filename- Download generated files
Troubleshooting
Three.js Not Available
If Three.js generation fails, the system automatically falls back to Blender. Make sure Blender is installed and BLENDER_PATH is set.
GLB Not Generated
- Check the debug report for detailed error information
- Verify Blender is installed and accessible
- Check server console for error messages
Port Already in Use
Change the port:
PORT=3001 node server.jsDevelopment
Adding New Object Types
Edit scripts/scene_parser.js to add new keywords and object creation logic.
Adding New Materials
Update the material detection in scene_parser.js and material creation in both glb_generator_threejs.js and generate_scene.py.
Customizing UI
Edit public/index.html to customize the web interface.
License
ISC
Contributing
Contributions welcome! Please ensure all code follows the existing style and includes appropriate error handling.
