Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3D AR Generator - MCP Demo Application

A comprehensive demo application that generates 3D objects from user prompts and makes them viewable in AR, using Model Context Protocol (MCP) as the orchestration layer.

🚀 Features

  • Prompt-based 3D Model Generation: Generate 3D models from text descriptions
  • Tripo AI Integration: Powered by Tripo AI API for high-quality 3D model generation
  • AR Preview: View models in AR using WebXR and model-viewer
  • MCP Integration: Model Context Protocol orchestration layer
  • Cross-platform AR: Works on iOS, Android, and Web browsers
  • Modern UI: Beautiful, responsive web interface

📋 Requirements

  • Python 3.8+
  • Tripo AI API key
  • Modern web browser with WebXR support
  • iOS device for AR Quick Look (optional)

🛠️ Setup Instructions

1. Clone the Repository

git clone https://github.com/hamadhk7/3D-AR-GENERATOR.git
cd 3D-AR-GENERATOR

2. Install Dependencies

pip install -r requirements.txt

3. Environment Configuration

Create a .env file in the root directory:

TRIPO_API_KEY=your_tripo_api_key_here
FLASK_ENV=development
FLASK_DEBUG=True

4. Start the Application

python scripts/start_web_server.py

The application will be available at http://localhost:5000

🎯 Example Prompts & Usage

Example 1: Futuristic Motorcycle

  • Prompt: "Generate me a detailed 3D model of a futuristic motorcycle"
  • Expected Output: High-quality GLB model of a futuristic motorcycle
  • AR View: Click "View in AR" to see in augmented reality

Example 2: Metallic Coffee Cup

  • Prompt: "A metallic coffee cup with leather seats"
  • Expected Output: Realistic coffee cup model with metallic finish
  • AR View: Available in both WebXR and AR Quick Look

Example 3: Animated Character

  • Prompt: "A cool bumble bee animated character"
  • Expected Output: Animated 3D character model
  • AR View: Interactive AR experience

🔧 API Integration

Chosen Service: Tripo AI

  • Reasoning: High-quality 3D model generation with realistic textures
  • API Endpoints: /task, /task/{id}, /task/health
  • Output Formats: GLB, OBJ, USDZ support
  • Response Time: 30-60 seconds for model generation

API Flow

  1. User submits prompt via web interface
  2. MCP orchestrates API call to Tripo AI
  3. System polls for generation completion
  4. Model downloaded in GLB format
  5. AR preview generated automatically

📱 AR Viewing Instructions

iOS (AR Quick Look)

  1. Generate a 3D model
  2. Click "Download USDZ" (if available)
  3. Open the USDZ file on iOS device
  4. Tap "View in AR" for AR Quick Look experience

Android/Web (WebXR)

  1. Generate a 3D model
  2. Click "View in AR" button
  3. Grant camera permissions
  4. Experience AR through WebXR

Web (Model Viewer)

  1. Generate a 3D model
  2. Click "View Model" for 3D preview
  3. Use mouse/touch to rotate and zoom
  4. Toggle wireframe mode for technical view

🏗️ Architecture

MCP Integration

  • MCP Server: src/mcp_server/server.py
  • Tools: Model generation, credit management, file handling
  • Handlers: Request processing and response formatting

Web Application

  • Flask App: src/web/app.py
  • API Routes: src/web/routes/api.py
  • Model Routes: src/web/routes/models.py
  • Templates: Modern, responsive UI

3D Model Handling

  • Download: Automatic GLB file download
  • Storage: Local file system with caching
  • Conversion: Ready for USDZ conversion
  • Preview: Three.js integration for 3D viewing

🎥 Demo Video

The demo showcases:

  1. Prompt Input: User enters "A metallic coffee cup with leather seats"
  2. Generation Process: Real-time progress tracking
  3. Model Download: Automatic GLB file retrieval
  4. AR Preview: WebXR AR experience
  5. Cross-platform: Works on mobile and desktop

🔐 Security & Configuration

  • API Keys: Stored securely in .env file (not in repository)
  • CORS: Properly configured for cross-origin requests
  • File Security: Safe file serving with validation
  • Error Handling: Comprehensive error management

📊 Performance

  • Generation Time: 30-60 seconds per model
  • File Size: Optimized GLB files (1-10MB)
  • Caching: Local file caching to reduce API calls
  • Credit Management: Real-time credit tracking

🚀 Deployment

Local Development

python scripts/start_web_server.py

Production Deployment

# Using Docker
docker-compose up -d

# Using Python directly
gunicorn src.web.app:app

📝 Documentation

  • API Setup: API_SETUP_GUIDE.md
  • Testing: TESTING_GUIDE.md
  • Configuration: config/settings.py
  • Logs: data/logs/ directory

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

📄 License

This project is licensed under the MIT License.


Note: This demo application successfully demonstrates all required features including MCP integration, 3D model generation, AR preview capabilities, and cross-platform compatibility.

About

AI-powered 3D model generator with MCP orchestration and AR visualization using Tripo AI, Flask, WebXR, and Model Viewer.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages