# AR 3D Models

This directory contains 3D models for Augmented Reality visualization in the Explore Lumajang AR application.

## Model Requirements

- **Format**: GLB (.glb) or GLTF (.gltf) with external assets
- **Optimization**: Mesh and texture optimization is critical for mobile performance
- **File Size**: Keep individual models under 10-15 MB
- **Polygons**: 10,000-50,000 triangles per model
- **Textures**: Use compressed formats (WebP or ASTC)

## Available Models

### waterfall.glb
- Representation of Tumpak Sewu Waterfall
- Suggested scale: ~2-3 meters in AR
- Color scheme: Blues and greens with water effects

### mountain.glb
- Representation of Mount Semeru
- Suggested scale: ~3-4 meters in AR
- Color scheme: Grays and browns with snow effects

### lake.glb
- Representation of Ranu Kumbolo Lake
- Suggested scale: ~2 meters in AR
- Color scheme: Blues with reflective water

### waterfall2.glb
- Representation of Kapas Biru Waterfall
- Suggested scale: ~2-3 meters in AR
- Color scheme: Turquoise with tropical vegetation

### village.glb
- Representation of Ranu Pani Village buildings
- Suggested scale: ~2 meters in AR
- Color scheme: Traditional architecture colors

## Creating or Acquiring 3D Models

### Option 1: Free 3D Model Websites
- **Sketchfab**: https://sketchfab.com (filter by GLB format)
- **Poly Haven**: https://polyhaven.com/models
- **TurboSquid Free**: https://www.turbosquid.com/Search/3D-Models/free
- **CGTrader Free**: https://www.cgtrader.com/free-3d-models

### Option 2: Creating Your Own
- **Blender**: Free 3D modeling software (blender.org)
- **Meshmixer**: For model cleanup and optimization
- **Substance Painter**: For texturing

### Option 3: AI Generated Models
- **Meshy AI**: Generates 3D models from text descriptions
- **DreamFusion**: Generates 3D from text

## Optimization Pipeline

1. **Model Creation**: Create or download your model
2. **Cleanup**: Remove unnecessary geometry and materials
3. **Decimation**: Reduce polygon count using tools like Meshmixer
4. **Baking**: Bake textures to reduce material complexity
5. **Compression**: Export as GLB with compression enabled
6. **Testing**: Load in AR and verify performance

## Using gltf-transform for Optimization

```bash
# Install gltf-transform
npm install -g @gltf-transform/cli

# Compress a model
gltf-transform optimize input.gltf output.glb

# Simplify geometry
gltf-transform simplify input.gltf output.glb --ratio=0.5
```

## Using Blender for Optimization

1. Import your model
2. Select all meshes
3. Decimation modifier (target face ratio: 0.5-0.8)
4. Remove unused materials
5. UV optimize if needed
6. Export as GLB

## Loading Models in AR

Models are loaded automatically when entering AR view. The app will:

1. Detect if ARCore is supported
2. Initialize AR session
3. Wait for plane detection
4. Allow user to place model on detected surface
5. Provide gesture controls for manipulation

## Troubleshooting

### Model not appearing
- Check file exists in assets/models/ directory
- Verify path in destination_service.dart matches filename
- Check console logs for loading errors
- Ensure model has valid materials

### Model appears distorted
- Check UV coordinates in Blender/3D editor
- Verify normals are calculated correctly
- Try reimporting and checking textures

### Performance issues
- Reduce polygon count further
- Compress textures more aggressively
- Reduce animation complexity
- Check Material complexity

## Integration with App

Models are loaded via ar_flutter_plugin. The app handles:

- Model loading from assets
- Gesture-based transformation (rotate, scale, move)
- Plane detection and placement
- Real-time rendering

To add a new model:

1. Place GLB/GLTF file in this directory
2. Update `destination_service.dart` with path
3. Test in AR view
