> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 3D Models

> Generate, manipulate, and optimize 3D models using AI for games, product design, and visualization

# 3D Model Generation with AI

Create stunning 3D models, environments, and assets using AI-powered generation tools. Perfect for game development, product design, architectural visualization, and creative projects.

## Overview

AI 3D model generation enables:

* **Text-to-3D creation** - Generate models from descriptions
* **Image-to-3D conversion** - Transform 2D images into 3D objects
* **Model optimization** - Reduce complexity while maintaining quality
* **Texture generation** - Create realistic materials and surfaces
* **Animation rigging** - Prepare models for movement and interaction

<CardGroup cols={2}>
  <Card title="Text-to-3D" icon="wand-magic-sparkles">
    Generate 3D models from text descriptions
  </Card>

  <Card title="Image-to-3D" icon="image">
    Convert 2D images into 3D objects
  </Card>

  <Card title="Model Optimization" icon="gauge-high">
    Optimize geometry and reduce polygon count
  </Card>

  <Card title="Texture Synthesis" icon="palette">
    Generate realistic materials and textures
  </Card>
</CardGroup>

## Quick Start

<CodeGroup>
  ```python Python theme={"system"}
  import requests
  import base64
  import json
  from PIL import Image
  import io

  class AI3DModelGenerator:
      def __init__(self, api_key):
          self.api_key = api_key
      
      def text_to_3d(self, description, style="realistic", quality="high"):
          """Generate 3D model from text description"""
          
          response = requests.post(
              "https://api.anyapi.ai/v1/3d/text-to-3d",
              headers={
                  "Authorization": f"Bearer {self.api_key}",
                  "Content-Type": "application/json"
              },
              json={
                  "model": "shap-e",
                  "prompt": description,
                  "style": style,
                  "quality": quality,
                  "output_format": "obj",
                  "include_textures": True,
                  "polygon_count": "medium"
              }
          )
          
          result = response.json()
          return {
              "model_url": result["data"]["model_url"],
              "texture_url": result["data"].get("texture_url"),
              "format": result["data"]["format"],
              "polygon_count": result["data"]["polygon_count"]
          }
      
      def image_to_3d(self, image_path, depth_estimation="auto"):
          """Convert 2D image to 3D model"""
          
          # Encode image to base64
          with open(image_path, "rb") as image_file:
              image_base64 = base64.b64encode(image_file.read()).decode('utf-8')
          
          response = requests.post(
              "https://api.anyapi.ai/v1/3d/image-to-3d",
              headers={
                  "Authorization": f"Bearer {self.api_key}",
                  "Content-Type": "application/json"
              },
              json={
                  "model": "point-e",
                  "image": image_base64,
                  "depth_estimation": depth_estimation,
                  "output_format": "obj",
                  "generate_backface": True,
                  "smooth_normals": True
              }
          )
          
          result = response.json()
          return {
              "model_url": result["data"]["model_url"],
              "preview_url": result["data"]["preview_url"],
              "vertices": result["data"]["vertex_count"],
              "faces": result["data"]["face_count"]
          }
      
      def optimize_model(self, model_url, target_polygons=None, quality_preset="balanced"):
          """Optimize 3D model for performance"""
          
          optimization_settings = {
              "low": {"decimation": 0.3, "texture_size": 512},
              "balanced": {"decimation": 0.5, "texture_size": 1024}, 
              "high": {"decimation": 0.7, "texture_size": 2048}
          }
          
          settings = optimization_settings.get(quality_preset, optimization_settings["balanced"])
          
          response = requests.post(
              "https://api.anyapi.ai/v1/3d/optimize",
              headers={
                  "Authorization": f"Bearer {self.api_key}",
                  "Content-Type": "application/json"
              },
              json={
                  "input_model": model_url,
                  "target_polygons": target_polygons,
                  "decimation_ratio": settings["decimation"],
                  "preserve_uv": True,
                  "preserve_boundaries": True,
                  "max_texture_size": settings["texture_size"]
              }
          )
          
          result = response.json()
          return {
              "optimized_model_url": result["data"]["model_url"],
              "original_polygons": result["data"]["original_count"],
              "optimized_polygons": result["data"]["optimized_count"],
              "reduction_ratio": result["data"]["reduction_ratio"]
          }
      
      def generate_texture(self, model_url, texture_description, resolution=1024):
          """Generate texture for 3D model"""
          
          response = requests.post(
              "https://api.anyapi.ai/v1/3d/texture-generation",
              headers={
                  "Authorization": f"Bearer {self.api_key}",
                  "Content-Type": "application/json"
              },
              json={
                  "model": "texture-synthesis",
                  "input_model": model_url,
                  "texture_prompt": texture_description,
                  "resolution": resolution,
                  "uv_unwrap": True,
                  "seamless": True,
                  "include_normal_map": True,
                  "include_roughness_map": True
              }
          )
          
          result = response.json()
          return {
              "diffuse_map": result["data"]["diffuse_url"],
              "normal_map": result["data"]["normal_url"],
              "roughness_map": result["data"]["roughness_url"],
              "uv_layout": result["data"]["uv_layout_url"]
          }
      
      def create_variations(self, base_description, variation_count=3):
          """Create multiple variations of a 3D model"""
          
          variations = []
          
          variation_styles = [
              "stylized and cartoon-like",
              "realistic and detailed",
              "minimalist and geometric",
              "organic and natural",
              "futuristic and sci-fi"
          ]
          
          for i in range(variation_count):
              style = variation_styles[i % len(variation_styles)]
              varied_description = f"{base_description}, {style} style"
              
              model_result = self.text_to_3d(varied_description, style="mixed")
              
              variations.append({
                  "description": varied_description,
                  "style": style,
                  "model_url": model_result["model_url"],
                  "texture_url": model_result.get("texture_url")
              })
          
          return variations
      
      def rig_for_animation(self, model_url, rig_type="humanoid"):
          """Add animation rig to 3D model"""
          
          response = requests.post(
              "https://api.anyapi.ai/v1/3d/rigging",
              headers={
                  "Authorization": f"Bearer {self.api_key}",
                  "Content-Type": "application/json"
              },
              json={
                  "input_model": model_url,
                  "rig_type": rig_type,
                  "auto_weights": True,
                  "include_ik": True,
                  "bone_count": "standard"
              }
          )
          
          result = response.json()
          return {
              "rigged_model_url": result["data"]["model_url"],
              "armature_url": result["data"]["armature_url"],
              "bone_count": result["data"]["bone_count"],
              "animation_ready": result["data"]["animation_ready"]
          }

  # Usage examples
  generator = AI3DModelGenerator("your_api_key")

  # Generate 3D model from text
  model_result = generator.text_to_3d(
      "A medieval castle with tall towers and stone walls",
      style="realistic",
      quality="high"
  )
  print(f"Generated model: {model_result['model_url']}")

  # Convert image to 3D
  image_3d = generator.image_to_3d("product_photo.jpg")
  print(f"Image to 3D model: {image_3d['model_url']}")

  # Optimize for web/mobile use
  optimized = generator.optimize_model(
      model_result['model_url'],
      target_polygons=5000,
      quality_preset="balanced"
  )
  print(f"Optimized model: {optimized['optimized_model_url']}")

  # Generate custom texture
  texture_result = generator.generate_texture(
      model_result['model_url'],
      "weathered stone texture with moss and age marks",
      resolution=2048
  )
  print(f"Custom texture: {texture_result['diffuse_map']}")

  # Create variations
  variations = generator.create_variations(
      "A futuristic vehicle",
      variation_count=3
  )
  for i, variation in enumerate(variations):
      print(f"Variation {i+1}: {variation['description']} - {variation['model_url']}")
  ```

  ```javascript JavaScript theme={"system"}
  class AI3DModelGenerator {
    constructor(apiKey) {
      this.apiKey = apiKey;
    }

    async textTo3D(description, style = 'realistic', quality = 'high') {
      const response = await fetch('https://api.anyapi.ai/v1/3d/text-to-3d', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          model: 'shap-e',
          prompt: description,
          style: style,
          quality: quality,
          output_format: 'obj',
          include_textures: true,
          polygon_count: 'medium'
        })
      });

      const result = await response.json();
      return {
        modelUrl: result.data.model_url,
        textureUrl: result.data.texture_url,
        format: result.data.format,
        polygonCount: result.data.polygon_count
      };
    }

    async imageTo3D(imageFile, depthEstimation = 'auto') {
      // Convert file to base64
      const imageBase64 = await this.fileToBase64(imageFile);

      const response = await fetch('https://api.anyapi.ai/v1/3d/image-to-3d', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          model: 'point-e',
          image: imageBase64,
          depth_estimation: depthEstimation,
          output_format: 'obj',
          generate_backface: true,
          smooth_normals: true
        })
      });

      const result = await response.json();
      return {
        modelUrl: result.data.model_url,
        previewUrl: result.data.preview_url,
        vertices: result.data.vertex_count,
        faces: result.data.face_count
      };
    }

    async optimizeModel(modelUrl, targetPolygons = null, qualityPreset = 'balanced') {
      const optimizationSettings = {
        low: { decimation: 0.3, textureSize: 512 },
        balanced: { decimation: 0.5, textureSize: 1024 },
        high: { decimation: 0.7, textureSize: 2048 }
      };

      const settings = optimizationSettings[qualityPreset] || optimizationSettings.balanced;

      const response = await fetch('https://api.anyapi.ai/v1/3d/optimize', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          input_model: modelUrl,
          target_polygons: targetPolygons,
          decimation_ratio: settings.decimation,
          preserve_uv: true,
          preserve_boundaries: true,
          max_texture_size: settings.textureSize
        })
      });

      const result = await response.json();
      return {
        optimizedModelUrl: result.data.model_url,
        originalPolygons: result.data.original_count,
        optimizedPolygons: result.data.optimized_count,
        reductionRatio: result.data.reduction_ratio
      };
    }

    async generateTexture(modelUrl, textureDescription, resolution = 1024) {
      const response = await fetch('https://api.anyapi.ai/v1/3d/texture-generation', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          model: 'texture-synthesis',
          input_model: modelUrl,
          texture_prompt: textureDescription,
          resolution: resolution,
          uv_unwrap: true,
          seamless: true,
          include_normal_map: true,
          include_roughness_map: true
        })
      });

      const result = await response.json();
      return {
        diffuseMap: result.data.diffuse_url,
        normalMap: result.data.normal_url,
        roughnessMap: result.data.roughness_url,
        uvLayout: result.data.uv_layout_url
      };
    }

    async createVariations(baseDescription, variationCount = 3) {
      const variations = [];
      const variationStyles = [
        'stylized and cartoon-like',
        'realistic and detailed', 
        'minimalist and geometric',
        'organic and natural',
        'futuristic and sci-fi'
      ];

      for (let i = 0; i < variationCount; i++) {
        const style = variationStyles[i % variationStyles.length];
        const variedDescription = `${baseDescription}, ${style} style`;

        const modelResult = await this.textTo3D(variedDescription, 'mixed');

        variations.push({
          description: variedDescription,
          style: style,
          modelUrl: modelResult.modelUrl,
          textureUrl: modelResult.textureUrl
        });
      }

      return variations;
    }

    async rigForAnimation(modelUrl, rigType = 'humanoid') {
      const response = await fetch('https://api.anyapi.ai/v1/3d/rigging', {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${this.apiKey}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          input_model: modelUrl,
          rig_type: rigType,
          auto_weights: true,
          include_ik: true,
          bone_count: 'standard'
        })
      });

      const result = await response.json();
      return {
        riggedModelUrl: result.data.model_url,
        armatureUrl: result.data.armature_url,
        boneCount: result.data.bone_count,
        animationReady: result.data.animation_ready
      };
    }

    async fileToBase64(file) {
      return new Promise((resolve, reject) => {
        const reader = new FileReader();
        reader.onload = () => resolve(reader.result.split(',')[1]);
        reader.onerror = reject;
        reader.readAsDataURL(file);
      });
    }
  }

  // Usage example
  const generator = new AI3DModelGenerator('your_api_key');

  // Generate from text description
  generator.textTo3D('A steampunk airship with copper details')
    .then(result => {
      console.log('Generated model:', result.modelUrl);
      
      // Display in Three.js scene
      displayModel(result.modelUrl);
    });

  // Convert uploaded image to 3D
  document.getElementById('imageUpload').addEventListener('change', async (event) => {
    const file = event.target.files[0];
    if (file) {
      const result = await generator.imageTo3D(file);
      console.log('Image to 3D:', result.modelUrl);
      displayModel(result.modelUrl);
    }
  });

  function displayModel(modelUrl) {
    // Three.js model loading and display code
    const loader = new THREE.OBJLoader();
    loader.load(modelUrl, function(object) {
      scene.add(object);
      renderer.render(scene, camera);
    });
  }
  ```
</CodeGroup>

## Advanced 3D Generation Workflows

### Game Asset Pipeline

```python theme={"system"}
class GameAssetPipeline:
    def __init__(self, api_key):
        self.api_key = api_key
        self.asset_database = {}
    
    def create_game_character(self, character_description, game_style="realistic"):
        """Create a complete game character with LOD variations"""
        
        # Generate base character model
        base_model = self.generate_character_base(character_description, game_style)
        
        # Create multiple Level of Detail (LOD) versions
        lod_models = self.create_lod_variations(base_model["model_url"])
        
        # Generate character textures
        textures = self.create_character_textures(base_model["model_url"], character_description)
        
        # Add animation rig
        rigged_model = self.add_character_rig(base_model["model_url"])
        
        # Generate animation set
        animations = self.create_character_animations(rigged_model["rigged_model_url"])
        
        character_asset = {
            "character_id": f"char_{hash(character_description) % 10000}",
            "description": character_description,
            "models": {
                "base": base_model,
                "lod_variants": lod_models,
                "rigged": rigged_model
            },
            "textures": textures,
            "animations": animations,
            "game_ready": True
        }
        
        self.asset_database[character_asset["character_id"]] = character_asset
        return character_asset
    
    def generate_character_base(self, description, style):
        """Generate base character model"""
        
        style_prompts = {
            "realistic": "photorealistic human character with natural proportions",
            "stylized": "stylized character with appealing proportions and clean geometry",
            "cartoon": "cartoon character with exaggerated features and simple forms",
            "fantasy": "fantasy character with unique features and detailed design"
        }
        
        full_prompt = f"{description}, {style_prompts.get(style, style)}, game-ready topology"
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/text-to-3d",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "model": "character-gen",
                "prompt": full_prompt,
                "style": style,
                "topology": "quad-based",
                "symmetrical": True,
                "output_format": "fbx"
            }
        )
        
        return response.json()["data"]
    
    def create_lod_variations(self, base_model_url):
        """Create Level of Detail variations for performance"""
        
        lod_configs = [
            {"name": "LOD0", "quality": 1.0, "polygons": None},  # Original
            {"name": "LOD1", "quality": 0.7, "polygons": 15000},
            {"name": "LOD2", "quality": 0.4, "polygons": 5000},
            {"name": "LOD3", "quality": 0.2, "polygons": 1000}
        ]
        
        lod_models = []
        
        for config in lod_configs:
            if config["name"] == "LOD0":
                lod_models.append({
                    "level": config["name"],
                    "model_url": base_model_url,
                    "polygon_count": "original"
                })
            else:
                optimized = self.optimize_for_lod(
                    base_model_url, 
                    config["polygons"], 
                    config["quality"]
                )
                lod_models.append({
                    "level": config["name"],
                    "model_url": optimized["model_url"],
                    "polygon_count": optimized["polygon_count"]
                })
        
        return lod_models
    
    def optimize_for_lod(self, model_url, target_polygons, quality_factor):
        """Optimize model for specific LOD level"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/lod-optimization",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": model_url,
                "target_polygons": target_polygons,
                "quality_factor": quality_factor,
                "preserve_silhouette": True,
                "maintain_uv_seams": True,
                "smart_decimation": True
            }
        )
        
        return response.json()["data"]
    
    def create_character_textures(self, model_url, description):
        """Generate complete texture set for character"""
        
        texture_types = [
            ("diffuse", f"realistic skin and clothing texture for {description}"),
            ("normal", f"normal map with skin details and fabric texture for {description}"),
            ("specular", f"specular map showing appropriate shine and reflectivity for {description}"),
            ("emission", f"emission map for glowing elements or magical effects on {description}")
        ]
        
        textures = {}
        
        for texture_type, prompt in texture_types:
            response = requests.post(
                "https://api.anyapi.ai/v1/3d/texture-generation",
                headers={
                    "Authorization": f"Bearer {self.api_key}",
                    "Content-Type": "application/json"
                },
                json={
                    "model": "character-texture",
                    "input_model": model_url,
                    "texture_type": texture_type,
                    "prompt": prompt,
                    "resolution": 2048,
                    "seamless": True
                }
            )
            
            textures[texture_type] = response.json()["data"]["texture_url"]
        
        return textures
    
    def add_character_rig(self, model_url):
        """Add animation rig to character"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/character-rigging",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": model_url,
                "rig_type": "humanoid",
                "auto_bone_placement": True,
                "include_facial_rig": True,
                "finger_bones": True,
                "ik_chains": ["arms", "legs"],
                "constraint_setup": True
            }
        )
        
        return response.json()["data"]
    
    def create_character_animations(self, rigged_model_url):
        """Generate basic animation set"""
        
        animation_types = [
            "idle_breathing",
            "walk_cycle", 
            "run_cycle",
            "jump",
            "attack_basic",
            "hit_reaction",
            "death"
        ]
        
        animations = {}
        
        for anim_type in animation_types:
            response = requests.post(
                "https://api.anyapi.ai/v1/3d/animation-generation",
                headers={
                    "Authorization": f"Bearer {self.api_key}",
                    "Content-Type": "application/json"
                },
                json={
                    "rigged_model": rigged_model_url,
                    "animation_type": anim_type,
                    "duration": self.get_animation_duration(anim_type),
                    "loop": self.is_looping_animation(anim_type),
                    "quality": "game_ready"
                }
            )
            
            animations[anim_type] = {
                "animation_url": response.json()["data"]["animation_url"],
                "duration": response.json()["data"]["duration"],
                "looping": response.json()["data"]["looping"]
            }
        
        return animations
    
    def get_animation_duration(self, anim_type):
        """Get appropriate duration for animation type"""
        durations = {
            "idle_breathing": 3.0,
            "walk_cycle": 1.0,
            "run_cycle": 0.8,
            "jump": 1.5,
            "attack_basic": 1.2,
            "hit_reaction": 0.5,
            "death": 2.0
        }
        return durations.get(anim_type, 1.0)
    
    def is_looping_animation(self, anim_type):
        """Determine if animation should loop"""
        looping_anims = ["idle_breathing", "walk_cycle", "run_cycle"]
        return anim_type in looping_anims
    
    def create_environment_set(self, theme, complexity="medium"):
        """Create a set of environment assets"""
        
        environment_elements = [
            f"{theme} building architecture",
            f"{theme} natural vegetation and plants",
            f"{theme} props and decorative objects",
            f"{theme} terrain and landscape features",
            f"{theme} lighting and atmosphere elements"
        ]
        
        environment_assets = []
        
        for element in environment_elements:
            asset = self.generate_environment_asset(element, complexity)
            environment_assets.append(asset)
        
        return {
            "theme": theme,
            "complexity": complexity,
            "assets": environment_assets,
            "asset_count": len(environment_assets)
        }
    
    def generate_environment_asset(self, description, complexity):
        """Generate individual environment asset"""
        
        complexity_settings = {
            "low": {"polygons": 2000, "texture_res": 512},
            "medium": {"polygons": 8000, "texture_res": 1024},
            "high": {"polygons": 20000, "texture_res": 2048}
        }
        
        settings = complexity_settings.get(complexity, complexity_settings["medium"])
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/environment-generation",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "model": "environment-gen",
                "prompt": f"{description}, game environment asset",
                "polygon_budget": settings["polygons"],
                "texture_resolution": settings["texture_res"],
                "modular": True,
                "collision_mesh": True
            }
        )
        
        return response.json()["data"]

# Usage
game_pipeline = GameAssetPipeline("your_api_key")

# Create complete game character
character = game_pipeline.create_game_character(
    "Female elf archer with leather armor and mystical bow",
    game_style="fantasy"
)

print(f"Character ID: {character['character_id']}")
print(f"LOD models: {len(character['models']['lod_variants'])}")
print(f"Animations: {list(character['animations'].keys())}")

# Create environment set
environment = game_pipeline.create_environment_set("medieval fantasy village", "high")
print(f"Environment assets: {environment['asset_count']}")
```

### Product Design and Prototyping

```python theme={"system"}
class ProductDesignStudio:
    def __init__(self, api_key):
        self.api_key = api_key
        self.design_iterations = {}
    
    def design_product_concept(self, product_description, design_brief):
        """Create initial product concept from description"""
        
        concept_prompt = f"""
        Product: {product_description}
        Design Brief: {design_brief}
        
        Create a professional product design with:
        - Functional form and ergonomics
        - Aesthetic appeal and modern styling
        - Manufacturing feasibility
        - User-centered design principles
        """
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/product-design",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "model": "product-designer",
                "prompt": concept_prompt,
                "design_style": "modern",
                "output_format": "step",
                "include_technical_drawings": True,
                "cad_compatible": True
            }
        )
        
        concept_data = response.json()["data"]
        
        design_id = f"design_{hash(product_description) % 10000}"
        self.design_iterations[design_id] = {
            "original_concept": concept_data,
            "iterations": [],
            "description": product_description,
            "brief": design_brief
        }
        
        return {
            "design_id": design_id,
            "concept_model": concept_data["model_url"],
            "technical_drawings": concept_data["drawings_url"],
            "specifications": concept_data["specs"]
        }
    
    def iterate_design(self, design_id, feedback, iteration_focus="ergonomics"):
        """Create design iteration based on feedback"""
        
        if design_id not in self.design_iterations:
            return {"error": "Design not found"}
        
        original_design = self.design_iterations[design_id]
        
        iteration_prompts = {
            "ergonomics": "improve ergonomics and user comfort",
            "aesthetics": "enhance visual appeal and styling",
            "functionality": "optimize functional features and usability",
            "manufacturing": "simplify for easier manufacturing and cost reduction",
            "sustainability": "incorporate sustainable materials and eco-friendly design"
        }
        
        focus_prompt = iteration_prompts.get(iteration_focus, iteration_focus)
        
        iteration_prompt = f"""
        Based on this feedback: {feedback}
        
        Focus on: {focus_prompt}
        
        Original product: {original_design['description']}
        Design brief: {original_design['brief']}
        
        Create an improved version that addresses the feedback while maintaining the core design intent.
        """
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/design-iteration",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "base_model": original_design["original_concept"]["model_url"],
                "iteration_prompt": iteration_prompt,
                "preserve_proportions": True,
                "maintain_functionality": True,
                "output_format": "step"
            }
        )
        
        iteration_data = response.json()["data"]
        
        # Store iteration
        self.design_iterations[design_id]["iterations"].append({
            "feedback": feedback,
            "focus": iteration_focus,
            "model_url": iteration_data["model_url"],
            "changes": iteration_data["change_summary"],
            "timestamp": datetime.now().isoformat()
        })
        
        return {
            "iteration_model": iteration_data["model_url"],
            "changes_made": iteration_data["change_summary"],
            "iteration_number": len(self.design_iterations[design_id]["iterations"])
        }
    
    def create_material_variants(self, design_id, materials_list):
        """Create variants with different materials"""
        
        if design_id not in self.design_iterations:
            return {"error": "Design not found"}
        
        base_model = self.design_iterations[design_id]["original_concept"]["model_url"]
        material_variants = []
        
        for material in materials_list:
            variant = self.apply_material(base_model, material)
            material_variants.append({
                "material": material,
                "model_url": variant["model_url"],
                "cost_estimate": variant["cost_estimate"],
                "durability_rating": variant["durability"]
            })
        
        return {
            "design_id": design_id,
            "material_variants": material_variants,
            "variant_count": len(material_variants)
        }
    
    def apply_material(self, model_url, material_description):
        """Apply specific material to model"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/material-application",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": model_url,
                "material": material_description,
                "realistic_rendering": True,
                "include_cost_analysis": True,
                "sustainability_rating": True
            }
        )
        
        return response.json()["data"]
    
    def generate_technical_documentation(self, design_id):
        """Generate technical documentation for manufacturing"""
        
        if design_id not in self.design_iterations:
            return {"error": "Design not found"}
        
        design_data = self.design_iterations[design_id]
        latest_model = design_data["original_concept"]["model_url"]
        
        # Use latest iteration if available
        if design_data["iterations"]:
            latest_model = design_data["iterations"][-1]["model_url"]
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/technical-docs",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": latest_model,
                "documentation_type": "manufacturing",
                "include_dimensions": True,
                "include_tolerances": True,
                "include_assembly": True,
                "include_bom": True,
                "format": "pdf"
            }
        )
        
        return response.json()["data"]
    
    def create_color_variants(self, design_id, color_schemes):
        """Create color variants of the design"""
        
        if design_id not in self.design_iterations:
            return {"error": "Design not found"}
        
        base_model = self.design_iterations[design_id]["original_concept"]["model_url"]
        color_variants = []
        
        for scheme in color_schemes:
            variant = self.apply_color_scheme(base_model, scheme)
            color_variants.append({
                "color_scheme": scheme,
                "model_url": variant["model_url"],
                "swatch_url": variant["color_swatch"]
            })
        
        return {
            "design_id": design_id,
            "color_variants": color_variants
        }
    
    def apply_color_scheme(self, model_url, color_scheme):
        """Apply color scheme to model"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/color-application",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": model_url,
                "color_scheme": color_scheme,
                "maintain_materials": True,
                "generate_swatch": True
            }
        )
        
        return response.json()["data"]
    
    def export_for_manufacturing(self, design_id, export_format="step"):
        """Export design in manufacturing-ready format"""
        
        if design_id not in self.design_iterations:
            return {"error": "Design not found"}
        
        design_data = self.design_iterations[design_id]
        model_url = design_data["original_concept"]["model_url"]
        
        # Use latest iteration if available
        if design_data["iterations"]:
            model_url = design_data["iterations"][-1]["model_url"]
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/manufacturing-export",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "input_model": model_url,
                "export_format": export_format,
                "manufacturing_ready": True,
                "include_toolpath": True,
                "quality_check": True
            }
        )
        
        return response.json()["data"]

# Usage
product_studio = ProductDesignStudio("your_api_key")

# Create initial product concept
concept = product_studio.design_product_concept(
    "Wireless charging desk lamp with adjustable arm",
    "Modern minimalist design for home office, sustainable materials, user-friendly controls"
)

print(f"Design ID: {concept['design_id']}")
print(f"Concept model: {concept['concept_model']}")

# Iterate based on feedback
iteration = product_studio.iterate_design(
    concept['design_id'],
    "The base seems too small for stability, and the charging pad should be more prominent",
    "functionality"
)

print(f"Iteration model: {iteration['iteration_model']}")
print(f"Changes made: {iteration['changes_made']}")

# Create material variants
materials = ["brushed aluminum", "bamboo wood", "recycled plastic", "carbon fiber"]
material_variants = product_studio.create_material_variants(concept['design_id'], materials)

print(f"Material variants: {material_variants['variant_count']}")

# Generate technical documentation
tech_docs = product_studio.generate_technical_documentation(concept['design_id'])
print(f"Technical docs: {tech_docs['documentation_url']}")
```

### Architectural Visualization

```python theme={"system"}
class ArchitecturalVisualizer:
    def __init__(self, api_key):
        self.api_key = api_key
        self.projects = {}
    
    def create_building_design(self, architectural_brief, building_type="residential"):
        """Create architectural design from brief"""
        
        building_prompts = {
            "residential": "modern residential architecture with clean lines and natural lighting",
            "commercial": "professional commercial building with functional design and accessibility",
            "industrial": "efficient industrial building with practical layouts and material flow",
            "cultural": "inspiring cultural building with unique architectural features"
        }
        
        style_context = building_prompts.get(building_type, building_type)
        
        full_prompt = f"""
        Architectural Brief: {architectural_brief}
        Building Type: {building_type}
        Style Context: {style_context}
        
        Create architectural design with:
        - Proper structural elements and realistic proportions
        - Environmental context and site integration
        - Natural lighting and ventilation considerations
        - Accessible design and building code compliance
        - Sustainable design principles
        """
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/architectural-design",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "model": "architect-ai",
                "prompt": full_prompt,
                "building_type": building_type,
                "include_site_context": True,
                "structural_analysis": True,
                "output_format": "ifc",
                "lod": "300"  # Level of Detail for construction
            }
        )
        
        building_data = response.json()["data"]
        
        project_id = f"arch_{hash(architectural_brief) % 10000}"
        self.projects[project_id] = {
            "brief": architectural_brief,
            "building_type": building_type,
            "design_data": building_data,
            "renderings": [],
            "floor_plans": []
        }
        
        return {
            "project_id": project_id,
            "building_model": building_data["model_url"],
            "floor_plans": building_data["floor_plans_url"],
            "structural_data": building_data["structural_url"]
        }
    
    def create_interior_design(self, project_id, room_specifications):
        """Create interior design for building"""
        
        if project_id not in self.projects:
            return {"error": "Project not found"}
        
        building_model = self.projects[project_id]["design_data"]["model_url"]
        interior_designs = {}
        
        for room_name, room_spec in room_specifications.items():
            interior = self.design_room_interior(building_model, room_name, room_spec)
            interior_designs[room_name] = interior
        
        self.projects[project_id]["interiors"] = interior_designs
        
        return {
            "project_id": project_id,
            "interior_designs": interior_designs,
            "rooms_designed": list(interior_designs.keys())
        }
    
    def design_room_interior(self, building_model, room_name, specifications):
        """Design interior for specific room"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/interior-design",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "building_model": building_model,
                "room_name": room_name,
                "specifications": specifications,
                "style": specifications.get("style", "modern"),
                "furniture_layout": True,
                "lighting_design": True,
                "material_selection": True
            }
        )
        
        return response.json()["data"]
    
    def create_photorealistic_rendering(self, project_id, view_specifications):
        """Create photorealistic architectural renderings"""
        
        if project_id not in self.projects:
            return {"error": "Project not found"}
        
        building_model = self.projects[project_id]["design_data"]["model_url"]
        renderings = []
        
        for view_spec in view_specifications:
            rendering = self.render_architectural_view(building_model, view_spec)
            renderings.append(rendering)
        
        self.projects[project_id]["renderings"] = renderings
        
        return {
            "project_id": project_id,
            "renderings": renderings,
            "rendering_count": len(renderings)
        }
    
    def render_architectural_view(self, building_model, view_spec):
        """Create single architectural rendering"""
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/architectural-render",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "building_model": building_model,
                "camera_position": view_spec["camera_position"],
                "time_of_day": view_spec.get("time_of_day", "golden_hour"),
                "weather": view_spec.get("weather", "clear"),
                "season": view_spec.get("season", "spring"),
                "resolution": view_spec.get("resolution", "4k"),
                "style": view_spec.get("style", "photorealistic"),
                "include_people": view_spec.get("include_people", True),
                "include_vehicles": view_spec.get("include_vehicles", False)
            }
        )
        
        return response.json()["data"]
    
    def create_virtual_tour(self, project_id, tour_waypoints):
        """Create virtual reality tour of building"""
        
        if project_id not in self.projects:
            return {"error": "Project not found"}
        
        building_model = self.projects[project_id]["design_data"]["model_url"]
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/virtual-tour",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "building_model": building_model,
                "waypoints": tour_waypoints,
                "navigation_mode": "smooth",
                "include_hotspots": True,
                "vr_compatible": True,
                "web_compatible": True
            }
        )
        
        tour_data = response.json()["data"]
        
        self.projects[project_id]["virtual_tour"] = tour_data
        
        return {
            "project_id": project_id,
            "tour_url": tour_data["tour_url"],
            "vr_url": tour_data["vr_url"],
            "embed_code": tour_data["embed_code"]
        }
    
    def generate_construction_drawings(self, project_id):
        """Generate construction drawings and documentation"""
        
        if project_id not in self.projects:
            return {"error": "Project not found"}
        
        building_model = self.projects[project_id]["design_data"]["model_url"]
        
        response = requests.post(
            "https://api.anyapi.ai/v1/3d/construction-drawings",
            headers={
                "Authorization": f"Bearer {self.api_key}",
                "Content-Type": "application/json"
            },
            json={
                "building_model": building_model,
                "drawing_types": [
                    "floor_plans",
                    "elevations", 
                    "sections",
                    "details",
                    "structural_plans"
                ],
                "scale": "1:100",
                "include_dimensions": True,
                "include_annotations": True,
                "format": "dwg"
            }
        )
        
        return response.json()["data"]

# Usage
arch_visualizer = ArchitecturalVisualizer("your_api_key")

# Create building design
building = arch_visualizer.create_building_design(
    "Modern 3-story office building with glass facade, open floor plans, rooftop garden, and sustainable features",
    "commercial"
)

print(f"Project ID: {building['project_id']}")

# Create interior designs
room_specs = {
    "lobby": {
        "style": "modern minimalist",
        "features": ["reception desk", "seating area", "art installation"],
        "lighting": "natural and accent"
    },
    "office_floor": {
        "style": "collaborative workspace", 
        "features": ["open desk areas", "meeting rooms", "break areas"],
        "lighting": "task and ambient"
    },
    "conference_room": {
        "style": "executive",
        "features": ["large conference table", "presentation screen", "video conferencing"],
        "lighting": "adjustable"
    }
}

interiors = arch_visualizer.create_interior_design(building['project_id'], room_specs)
print(f"Interior designs created for: {interiors['rooms_designed']}")

# Create renderings
view_specs = [
    {
        "camera_position": "exterior_front",
        "time_of_day": "golden_hour",
        "weather": "clear",
        "include_people": True
    },
    {
        "camera_position": "lobby_interior",
        "time_of_day": "midday",
        "style": "photorealistic"
    },
    {
        "camera_position": "aerial_view",
        "time_of_day": "sunset",
        "include_vehicles": True
    }
]

renderings = arch_visualizer.create_photorealistic_rendering(building['project_id'], view_specs)
print(f"Created {renderings['rendering_count']} renderings")

# Create virtual tour
tour_waypoints = [
    {"name": "Building Entrance", "position": "front_entrance"},
    {"name": "Lobby", "position": "lobby_center"},
    {"name": "Office Floor", "position": "office_overview"},
    {"name": "Conference Room", "position": "conference_center"},
    {"name": "Rooftop Garden", "position": "rooftop_view"}
]

virtual_tour = arch_visualizer.create_virtual_tour(building['project_id'], tour_waypoints)
print(f"Virtual tour created: {virtual_tour['tour_url']}")
```

## 3D Model Formats and Optimization

### Format Comparison

| Format        | Best For                    | Features                         | File Size |
| ------------- | --------------------------- | -------------------------------- | --------- |
| **OBJ**       | General use, simple models  | Basic geometry, widely supported | Medium    |
| **FBX**       | Game development, animation | Animations, materials, rigging   | Large     |
| **GLTF/GLB**  | Web applications            | Optimized for web, PBR materials | Small     |
| **STL**       | 3D printing                 | Solid geometry, manufacturing    | Small     |
| **STEP/IGES** | CAD/Manufacturing           | Precise engineering data         | Large     |
| **USD**       | Film/VFX pipeline           | Advanced materials, scene graphs | Variable  |

### Optimization Strategies

<CardGroup cols={2}>
  <Card title="Polygon Reduction">
    Reduce triangle count while preserving visual quality
  </Card>

  <Card title="Texture Optimization">
    Compress textures and optimize UV layouts
  </Card>

  <Card title="LOD Generation">
    Create multiple detail levels for performance
  </Card>

  <Card title="Compression">
    Use format-specific compression techniques
  </Card>
</CardGroup>

## Best Practices

### 1. Model Quality

* **Proper topology**: Use quad-based geometry when possible
* **Scale accuracy**: Maintain real-world proportions
* **Clean geometry**: Remove unnecessary vertices and faces
* **UV mapping**: Create efficient texture coordinates

### 2. Performance Optimization

* **Polygon budgets**: Set appropriate limits for target platform
* **Texture resolution**: Balance quality with memory usage
* **Level of Detail**: Create multiple versions for different distances
* **Batching**: Group similar objects to reduce draw calls

### 3. Workflow Integration

* **File organization**: Use consistent naming and folder structure
* **Version control**: Track model iterations and changes
* **Asset pipeline**: Automate import/export processes
* **Quality assurance**: Validate models before deployment

### 4. Platform Considerations

* **Web deployment**: Optimize for fast loading and streaming
* **Mobile devices**: Reduce complexity for limited hardware
* **VR/AR applications**: Maintain high frame rates
* **Print preparation**: Ensure manifold geometry for 3D printing

## Common Use Cases

<CardGroup cols={2}>
  <Card title="Game Development">
    Characters, environments, props, and interactive objects
  </Card>

  <Card title="Product Design">
    Prototyping, visualization, and manufacturing preparation
  </Card>

  <Card title="Architecture">
    Building visualization, interior design, and construction planning
  </Card>

  <Card title="Entertainment">
    Film VFX, animation, and virtual production
  </Card>
</CardGroup>

<CardGroup cols={2}>
  <Card title="Education & Training">
    Interactive learning, simulations, and demonstrations
  </Card>

  <Card title="Marketing & Advertising">
    Product showcases, brand experiences, and campaigns
  </Card>

  <Card title="Manufacturing">
    Prototyping, tooling design, and quality control
  </Card>

  <Card title="Healthcare">
    Medical visualization, surgical planning, and training
  </Card>
</CardGroup>

## Model Recommendations

| Use Case               | Recommended Model              | Strengths                      |
| ---------------------- | ------------------------------ | ------------------------------ |
| **Text-to-3D**         | Shap-E, Point-E                | Fast generation, good geometry |
| **Image-to-3D**        | Point-E, TripoSR               | Accurate reconstruction        |
| **Character Creation** | Custom character models        | Anatomical accuracy            |
| **Environment Design** | Specialized environment models | Architectural knowledge        |
| **Product Design**     | CAD-aware models               | Manufacturing constraints      |

## Getting Started

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/get-started/quick-start">
    Generate your first 3D model
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/models/3d-models/overview">
    Explore 3D generation models
  </Card>

  <Card title="Create Images" icon="image" href="/use-cases/create-images">
    Start with 2D image generation
  </Card>

  <Card title="Animate Images" icon="play" href="/use-cases/animate-images">
    Add motion to your creations
  </Card>
</CardGroup>
