Terrain to Mesh Converter - User Guide
Overview
The Terrain to Mesh Converter is a powerful Unity tool that transforms Unity terrains into standard 3D meshes. This allows you to:
- Export terrains for use in other applications or game engines
- Optimize terrain rendering by converting specific areas to meshes
- Apply standard mesh modifiers and effects to your terrain geometry
- Combine your terrain with other mesh-based objects seamlessly
Quick Start
- Select Tools → TerrainToMesh from the Unity menu
- Select your terrain in the "Target Terrain" field
- Adjust the resolution if needed
- Click "Convert to Mesh"
Step-by-Step Instructions
Accessing the Tool
- In the Unity Editor, go to the top menu and select Tools → TerrainToMesh
- The Terrain to Mesh converter window will open
Basic Conversion
- Ensure your terrain is in the scene
- Drag your terrain into the "Target Terrain" field
- Set a name for the generated mesh in the "Mesh Name" field
- Click "Convert to Mesh" to generate a mesh from your terrain
Key Parameters Explained
Mesh Settings
- Mesh Name: The name for the generated GameObject and mesh asset
- Resolution Scale: Controls the detail level of the generated mesh
- Higher values (closer to 0.5) produce more detailed meshes with more vertices
- Lower values (closer to 0.1) produce simplified meshes with fewer vertices
- Default is 0.3 for a balance of detail and performance
Output Options
- Generate Collider: Automatically creates a MeshCollider component on the output mesh
- Enable for meshes that need collision detection
- Disable for purely visual meshes to improve performance
- Save Mesh Asset: When enabled, saves the mesh as a reusable asset in your project
- Recommended for meshes you want to reuse or prefab
Advanced Options
- Save Path: Customize where the mesh asset is saved in your project
- Default location: Assets/TerrainMeshes
- The tool automatically creates directories that don't exist
Best Practices
Resolution Selection
- High Resolution (0.4-0.5): Use for close-up views or when detail is critical
- Medium Resolution (0.2-0.3): Good balance for most game scenes
- Low Resolution (0.1-0.2): Use for distant terrain or performance-critical applications
The resolution scale directly affects:
- Vertex count and mesh complexity
- File size of the saved mesh
- Runtime performance
- Visual quality
Materials and Textures
- The converted mesh uses a URP Lit material by default
- If your terrain has a main texture, it will be applied to the mesh
- For complex terrain materials with multiple textures:
- Consider baking your terrain textures to a single texture before conversion
- Or manually set up a more complex material on the resulting mesh
Working with Large Terrains
- Converting very large terrains at high resolution may be memory-intensive
- Consider converting at a lower resolution scale
- Split your terrain into sections and convert each separately
- Use LOD (Level of Detail) techniques on the resulting meshes
Technical Notes
- The converter creates a polygon mesh that follows the terrain's heightmap
- Vertex density is determined by the resolution scale parameter
- The mesh uses the same transform position as the original terrain
- Terrain to Mesh conversion is generally faster than Mesh to Terrain conversion
Troubleshooting
Common Issues and Solutions
- Problem: Resulting mesh has jagged or stepped edges
Solution: Increase the Resolution Scale parameter for smoother results
- Problem: Conversion is taking too long or runs out of memory
Solution: Reduce the Resolution Scale or convert a smaller terrain
- Problem: Mesh appears different from the original terrain
Solution: Check that all terrain layers were properly baked; consider recreating complex materials manually
- Problem: Can't find the saved mesh asset
Solution: Verify the saved path in the console or check the default directory (Assets/TerrainMeshes)
- Problem: Collider is not accurate enough
Solution: Increase the Resolution Scale, as the collider follows the mesh geometry