Component to convert 3D models into Unity Terrain. Can work as with all objects on a layer, and only the selected objects. Does not require the manual addition of components of physics (colliders).
Add the 3D scene model that you want to convert into Terrain. The number of models is not limited, and they can have any nesting.
Important: You can use any model, but Unity Terrains can only be rectangular. Keep this in mind when converting non-rectangular models.
Select the menu item «Window / Infinity Code / Mesh to Terrain», to open the component.
Specify the required settings, click «Start» and wait for the conversion. Depending on your computer performance, the number of pieces and settings it can take from a few seconds to several minutes.
Important: If the model has a collider, other than «Mesh Collider», it can be converted incorrectly. To solve the problem, remove the collider component from models.
Description of fields
Mesh to Terrain window contains three sections:
- Meshes – List of mesh, which will be converted into terrains, and general conversion settings.
- Terrains – Settings of terrains.
- Textures – Settings of textures.
In «Mesh select type» section Meshes, select how you want to define a model for the transformation:
- GameObjects – Objects to be added manually. For all the added objects considered subobjects. To avoid errors, you must remove all unnecessary sub-objects of the objects do not belong to the terrain.
- Layers – As models for the conversion of all the models used in the layer. In order to avoid errors from the layer to remove all unnecessary objects that do not belong to the terrain.
In «Direction», specify the direction of raytracing:
- Normal - Rays go from top to bottom.
- Reversed - Rays go from bottom to top. Must be used if the polygon model is facing downwards.
In «Y Range», select the desired range of heights:
- Minimal Range - the range of values will be determined automatically based on the meshes boundaries Y.
- Long Mesh Side - the range of values will be determined automatically based on the meshes boundaries by the maximum size of X and Z.
- Fixed Value - allows you to specify a Y range manually. The higher the value, the lower the accuracy.
In «Type» section Terrains, select:
- Exist Terrains - If you want to convert your existing terrains. To do this, place the terrains under the models and add terrains to the list.
- New Terrains - Terrains will be created and placed under the model automatically. In the appropriate fields number of the terrains that will be created.
If «Type - New Terrains» is selected, then there are additional settings:
- Count - Number of terrains you want to get.
- Adjust size of meshes - The size of meshes will be adjusted to work around the problem of raycasting for very small and very big meshes.
After generation, Mesh to Terrain will restore the original hierarchy and size of meshes.
Important: If meshes are part of prefabs, after using this setting prefab will be lost.
- Bounds - Type boundary of the model:
- Auto Detect – model boundaries are determined automatically.
- From GameObject – boundaries of model set by another GameObject. This GameObject must be Cube without rotation and include the entire area you want to convert.
- Select Bounds – you manually select the boundaries (like in Collider). Click «Show Selected», to start select the boundaries.
- New terrains settings.
If you want to use smoothing, choose the «Use smoothing of height maps» and set the smoothing factor.
Field «Holes» determines the behavior of Mesh to Terrain for areas of models where the height is unknown (holes and the edge of the model, if the model is not rectangular):
- Minimum Value - will use the minimum height.
- Neighbor Average - height will be calculated on the basis of the neighboring known values.
Mesh to Terrain can optionally generate one texture for each Terrains.
Mesh to Terrain has two modes for generating textures:
- Camera - textures will be created using a dynamic camera with orthographic projection. Required Adjust size of meshes - ON.
Important: when generating textures, lighting is used, which will affect the result. Prepare the lighting first.
- Raycasting - textures will be created by raycasting the main textures of meshes.
Important: this texture generation mode only uses the main texture of the first material.
Convert from the context menu
In the «Hierarchy» right-click on the GameObject, you want to convert into terrain. Opens «Mesh to Terrain» with the selected GameObject.
Unity Terrains not support holes, but you can work around it.
Use «Holes» to determine the behavior of Mesh to Terrain for areas of models where the height is unknown (holes and the edge of the model, if the model is not rectangular).
If you want to make a holes, you can use third-party assets (Terrain Hole System or equivalent).
Working with Relief Terrain Pack
Relief Terrain Pack is not included with Mesh to Terrain package and by default integration is disabled.
Import Relief Terrain Pack to your project. Open Mesh to Terrain. Third-party / Enable Relief Terrain Pack.
No settings Relief Terrain Pack is required. If you have any questions about Relief Terrain Pack, you can find answers in the documentation of Relief Terrain Pack.
If you want to delete Relief Terrain Pack from the project, you should first disable it in Mesh to Terrain (Third-party / Disable Relief Terrain Pack).
If you forget to disable Relief Terrain Pack and removed it, then you will see errors in the console. To manually remove support of Relief Terrain Pack, open PlayerSettings (Edit / Project Settings / Player) and delete the corresponding entry from «Scripting Define Symbols».
In Unity Asset Store we ship only stable versions. Renewal period is several months.
Mesh to Terrain has a built-in update system, using which you can get early access to all versions and updates.
Click «Window / Infinity Code / Mesh to Terrain / Check Updates», to open window checking for updates. Enter your Invoice Number, select a channel of updates and click «Check New Versions».
If updates are available, you can read the list of changes and download the update.
If you have any problems with installing the update, then:
- Open an empty scene.
- Delete the folder «Infinity Code / Mesh to Terrain».
- Import the new asset version in the project.
After starting you get the error border or nothing happens.
There are two reasons for this:
- The models in the scene have a size that is insufficient for correct operation of physics. You need to increase the model in 100 + times and start the component again The problem is that the default scaling factor of imported models «0.01».
- You choose the models are not in the scene. Add model in the scene and convert them.
Terrains not correspond to the models axis Y.
- Scale up the model several times.
New terrains have a insufficient resolution / accuracy.
- Increase the Height Map Resolution.
- Increase the number of new terrains.
You can not see the grass or trees.
- Zoom in to the place where you draw grass or trees.
- Increase the value of «Tree Distance» in Terrain settings.
You receive an error «Selected meshes not in the scene», and the model is in the scene.
Please make sure that you choose a model from the tab «Scene».
If you have something does not work, you find a bug, or you have a suggestion, please contact us.
Please, specify your version of Unity, OS, and the current version of Mesh to Terrain.
We strive to answer all emails in the customer support within 24 hours.
We sincerely hope that you will enjoy using Mesh to Terrain.
If you have any questions or problems, please contact us.
We will try to help you as quickly as possible.
Please do not forget to leave your review in Unity Asset Store.
It is very important for us to have feedback from users to make our assets better.
For other users, it is also very important to make a right understanding of this asset.