Preparations

All the following assumes that you already have done:

  • Created a new terrain
  • Imported a heightmap
  • Calculated the lightmap
  • Imported all the splatmaps, treemaps, etc. you wish to use into Unity as RGB 24bit textures.
  • If using Unity 2.6, all the textures/maps you intend to use must be set to "readable" in the import settings.
  • If using Unity 3, all the textures/maps must have their Texture Type set to "Advanced" and then checked the "Read/Write enabled" option.

Once you're installed the Terrain Tools, you will find them in Terrain => Tom's Terrain Tools in the Unity editor.

You will then most likely want to use the Terrain Tools in the following order:

Splatmaps

splatmap dialog Precondition: You need to have set up (at least 4) textures for the terrain before applying the splatmap. At this time, the splatmap tool will use the first four textures. You can set up more if you want to use them to paint in details manually, they will be ignored by the script.

This is the easiest part. Simply drag your splat map to the dialog and hit the button.

The image will be processed and terrain textures applied to the terrain according to the colours in the splatmap. Textures will automatically be blended and colour values normalized so you don't have any dark or overbright spots.

Splatmaps must be square, in a power-of-two size and imported as RGB24 or RGBA32. They do not have to have the same resolution as the heightmap.

Trees

tree map dialog Precondition: You need to have set up at least 3 trees for the terrain.

The most configurable and powerful script. First, you need to drag the tree distribution map to the "Treemap" selector. Again, power-of-two, etc. Tree Density and Threshold control the amount of trees that will be placed. Density can not be above 1.0 which means every dot on your treemap will result in a tree being placed. The right value for this depends on your treemap, the size of your terrain and the scale of your trees. The default value works fine for FPS-size maps. Be careful with higher values, they can quickly create too many trees. Threshold is a kind of "sharpness" value. It determines how much colour your map requires at least for tree placement to happen. At high values, only the brightest spots in the treemap will have trees. At 0.0 you could have individual trees everywhere. The valid range is 0.0 to 1.0 Size Variation and Shadow Variation give a bit of randomness and thus more realism to tree sizes and shadows. The default values work fine for most cases, if you want to play around with them, I suggest changing them +/- 0.1 at a time. Shadow Size determines how large the blob shadow that is automatically calculated will be. The best value again depends on your tree and terrain size as well as the resolution of your lightmap. Shadow Color is, of course, the colour of your shadows. You may want to make it slightly brighter or darker to tune the appearance of the deep forests.

Grass and Bushes

grass and bush maps dialog Precondition: You need to have set up at least 6 grass textures or detail meshes.

This dialog takes two distribution maps. One for grass, the other for bushes. At least that is the idea, you can use them, mix them, in any way you like. Nothing says you can't have 2 grass textures and 4 bush types. The number is simply because of the RGB structure of your map images. The principle is the same as for tree maps - each colour stands for one type of grass texture or detail mesh, black means empty areas.

Grassmod and Bushmod are simple multipliers for the density of grass and bushes. Usually, you want grass to be dense while bushes are a bit more scattered about, which is what the default values accomplish.

Grassclumping is a value that makes it less likely that you get isolated, single grass billboards, which usually looks awkward. It works as a chance that around any grass placed, there will also be other grass nearby, even if the grassmap does not mention it. The default value works fine for most cases, if you want to change it, valid values are between 0.0 and 1.0

Overlay Map (optional)

overlay dialog Precondition: Nothing

The overlay script allows you to add additional terrain textures to your map, again according to a distribution map. The most common case that you will probably use it for is to add roads, paths, rivers, lakes and other well-defined features. There is a lot you can do with this script.

First, you need to drag your overlay map into the slot provided. You also need to select a terrain texture and drag it into the Overlay Texture slot. This texture will be added to your terrain textures array with the tile size values you give here.

Threshold again allows you to cut out soft edges and ignore any low noise your map might have.

When you apply this script, it will add your selected overlay texture to the map according to the overlay map. That is, it will lay down a path or road according to the road map that you've provided. Not only is this simpler than drawing the road inside Unity, it also allows you freedom in the creation of the map image. You could use bezier curves, for example, or use varying width. You could even take it from an actual map if you are re-creating a real-world environment. The script will also automatically blend the overlay texture with the existing splatmap and colour-correct the existing splatmap textures.

Clear Trees and Clear Grass will automatically remove trees and grass from the overlay parts, so that you don't have trees in the middle of your river or grass on your road. If your overlay map has soft edges, this removal will consider them, softly thinning out the grass around your path. Please note that removal of trees is very slow and also does not remove the tree blob shadows if you added them in the Trees script. It is often better to use an image manipulation program to simply substract the overlay map from the tree distribution map before applying that in the Trees script, which is why this option is by default disabled.

Finally Change Terrain is an incredibly powerful feature that will change the heightmap of the terrain as well. This enables you to use the Overlay Map script to actually carve rivers or lakes into your terrain (make sure they have soft edges!). Or you could use it to have a slightly elevated road, or maybe train tracks? The possibilities are endless. The value you put in here is in absolute measurement units, so it depends a lot on your terrain size, especially the Y value. Negative values cut into the terrain, positive values elevate it. Notice: The terrain lightmap is not being re-calculated when the terrain is changed.

Random Object Map (optional)

Precondition: Nothing

This script allows you the random-but-guided-by-a-distribution-map placement of any game object whatsoever. It works much like the tree, grass, etc. map scripts, except that it will interpret the map you give it as a grayscale "probability" of placing an object.

Max Number is the maximum number of objects the script will place. The actual number can be lower if your distribution map is largely black and the script has trouble finding valid spots, especially if you use a high spacing value (see below). For most reasonable numbers (i.e. a few hundred objects or less), the actual number of objects will usually be very close to the max number.

Spacing is the amount of space (in map units, not world units!) that you want to leave around each object. Use this to ensure that objects are not spawned so close that they intersect with each other. The default value of 1 should be good for most smaller objects, but if you use the script to place huge rocks, buildings or other large objects, you may want to increase it.

Above Ground is the number of world units that objects will be offset from the terrain (or other ground object). Use this for floating objects, or use a negative value to put objects partially into the ground (e.g. rocks, etc.). Note that this offset is relative to the unit center. A sphere will be placed half into the ground if Above Ground is zero, since that is where the object center is.

Use Layer allows you to control which layers are raycast against when finding the Y (height) value to place objects. You can use this to ensure that objects are only placed on terrain, for example, not on any objects that might sit on top of it already - or on the contrary, to make sure that your randomly spawned objects always sit on top of everything else.

Attachments