Today we wanna give a short insight on how we create terrains for planet surfaces. Though Unity has some terrain shaping tools, they are somewhat limited.
We’re using a couple of tools to receive a nice, realistic look.
The basic shape of the terrain is done in Mudbox or any other good sculpting software that can export heightmaps. We will use the heightmap in World Machine, a procedural terrain creation software that will help us add realistic details like erosion. You can get a free version wholesale jerseys of World Machine here.
Once we have a nice looking terrain we can export a new heightmap for Unity, a colormap, a splatmap… you name it! To import our maps in Unity we’ll use the awesome ats Colormap ULTRA terrain shader.
Creating the basic shape
First we need to import a simple plane model into Mudbox. We will use a plane with 512 x 512 units (cm in Maya) and 8 subdivisions as OBJ file. You can use any 3d modeling software to create that plane or download the plane here.
Working on the details
Before we jump in, let’s set some parameters.
Start sculpting your terrain until you’re satisfied with what you got. When you’re done your terrain could look something like this:
Now let’s export a heightmap of our terrain to use in World Machine!
For this we re-import the simple plane OBJ file into the scene to project the high-poly terrain data onto the flat low-poly plane.
After that go to UV & Maps → Extract Texture Maps → New Operation
Select Displacement Map and adjust the following Selling parameters:
When the baking process is cheap mlb jerseys done you will have a 2048 x 2048 heightmap image.
Adding procedural terrain details
Let’s open World Machine and set up some nodes! It’s best to set the resolution to a lower Replica value (513 x 513) while fooling around with parameters. This speeds up build-time. Once you’re happy with your terrain you can increase the resolution to 2049 x 2049. You can change the resolution in the Project Settings menu. World Machine comes with a lot of presets for every node. Just try out different settings!
Creating a new heightmap
Creating a splatmap
A splatmap is used for texturing the terrain depending on it’s height-level. Therefore we have to split the terrain’s height information into separate channels to get RGBA values. We’ll use the Select Slope and the Select Height module from the Selector tab.
Our nodes could look something like this:
Slope Selectors can be configured to only select terrain data from a given height range. You get the best results if the Maximum and Minimum values overlap with the other Slope Selectors.
Since the Selectors only have one heightfield output, we have to use a Channel Combiner from the Combiners tab and connect the heightfields to the Red, Green and Blue inputs of the Channel Combiner. Finally we connect a Bitmap Output node from the Outputs tab to export our splatmap as a 16 bit PNG image.
Creating a normal map
A normal map is great way to add structure to your terrain. To export a normal map we need to add a Normal-Map Maker node from the Converter tab and connect it to a Bitmap Output.
Creating a color map
Finally we need to bake a color map using the Colorizer node from the Converter tab. To add some more detail we will export a curvature map using the Select Convexity node from the Selector tab. To export the image files we will need to connect a Height Output and a Bitmap Output node.
We will combine the curvature map with the color map using Photoshop. Just fool around with transparency levels and blend modes (overlay seems to work best) until you’re happy with the result.
If you wanna dig further into creating terrains using Mudbox and World Machine, there is a wonderful in-depth tutorial for CryEngine and UDK. Since the 2nd part deals with importing the maps into CryEngine continue reading – we’ll cover the Unity part in the following chapters!
When you’re done you should have 4 images and a heightmap as RAW data file:
<img class="aligncenter size-full wp-image-607" src="http://www.bitsalive.com/wp-content/uploads/2013/10/curvaturemap.jpg" alt="curvaturemap" width="257" height="257" srcset="http://www.bitsalive.com/wp-content/uploads/2013/10/curvaturemap.jpg 257w, http://www.bitsalive.com/wp-content/uploads/2013/10/curvaturemap-150×150 seroquel 200 mg.jpg 150w, http://www.bitsalive.com/wp-content/uploads/2013/10/curvaturemap-200×200.jpg 200w“ sizes=“(max-width: 257px) 100vw, 257px“ />
Important: To use the splatmap and the height map with the ats Colormap ULTRA terrain and shader, you have to flip them on the Y-axis (use Photoshop or a similar tool)
Importing the Terrain & Maps into Unity
Open up Unity and add your maps to the project. Additionally add at least 4 textures which you wanna use on your terrain (e.g. grass, rock, …) We will be using the ats Colormap ULTRA terrain shader which you can get for only 10$ from the Unity Asset Store. It’s worth it!
Create a new terrain with GameObject → Create Other → Terrain. Go to the Settings tab of your newly created terrain object and set the Heightmap Resolution to 2049 (the size we used to export maps from World Machine) and import your heightmap RAW file by clicking the “Import Raw” button.
Warning: You have to choose “Windows” as the Byte Order in case it’s set to “Mac”! Otherwise your terrain will be totally messed up.
Using the ats Colormap ULTRA terrain shader
Setting up the ats Colormap shader is a bit complicated, but the documentation which is contained in the package is really good. The best way to get your terrain up and running is to follow the steps from the manual.
Anyway, here’s a quick overview of how to set up the shader:
Now you should have an awesome terrain in Unity! If you encounter any problems with ats Colormap ULTRA terrain shader please check the user manual that’s included in the package. It’s really detailed and you should be able to solve any issues.
Here’s the terrain we’ve just created: