Pages

Monday 27 January 2014

Creating a Simple Terrain in 3DS Max - Part 2: Creating the Material

In part one of this tutorial, we created a simple terrain using a height map. In this part, we will create a material that changes depending on the height of the terrain.

The material we will use creates a blend of 2 existing materials found in the 3dsmax material library, although it could be used to blend any materials.

Open your terrain scene from part 1 of the tutorial and load the 3dsmax material library. In the material editor create a blend material by clicking get material and start typing the word blend in the browser.


The blend material has 3 basic settings; 2 materials and a mask that creates the blend.

Apply the Ground_Grass to the material 1 slot and Ground_Grey_Dirt2 to the material 2 slot by dragging them from the browser onto the map buttons.

Apply the height map to the mask slot by clicking the button, selecting bitmap and navigating to your height map image.

Apply the blend material to your terrain and render the scene.


The terrain should now have grassy textures at the base and rocky textures higher up. You may notice that the textures are far too big for the terrain, so we need to modify the grass and dirt materials.

Depending on your height map, you may find that you have too much rock and not enough grass (or the other way around). You change the balance of the blend by activating the mixing curve and changing the settings. Try different settings until you are happy with the results.

In the blend material, click on the material 1 map button (Ground_Grass), then click on the diffuse map button for the grass material.

In the coordinates box, change the tiling settings to 5 x 5 and render the scene.

You will notice that the grass texture is now much smaller. You may also notice a repeating pattern in the grass.

Try changing the tiling settings to get a result you are happy with (remember that the tiling pattern is only really noticeable when viewed from a distance). I settled on 3 x 3, but yours may vary.

Once you are happy with the settings, try the same techniques to modify the dirt texture.

Creating a Simple Terrain in 3DS Max - Part 1: Creating the terrain


The following technique uses a height map to tell 3DS Max which parts of the object are higher than the others.

A height map is a black and white image where black is the lowest part of the map and white is the highest.

To create the height map, open Photoshop and make a new image at 1024x x 1024 pixels (File > New... or Ctrl + N).

Fill the background with black and create a new layer (Layer > New > Layer... or Ctrl + Shift + N).

The new layer will contain the information for our height map. It is tempting to try and paint your terrain manually, but this will usually look too synthetic and have sharp edges (think of Mario 64). To make our landscape look random, we are going to use the clouds filter.

Make sure your foreground is set to white and your background to black, then apply the clouds filter (Filter > Render > Clouds).

As you will see the filter produces totally random results. Try re-applying the filter a few times to see the variations it can make.

Save your image as a JPEG file (3DS Max will recognize PSD files, but they are usually quite big).

Open 3DS Max and create a plane in the top view (Create > Standard Primitives > Plane). Set the length and width to 100 and the segments to 50 x 50.

In the viewport, turn edged faces on to see the individual polys that have been created.

This will give us enough geometry to create some detail without over burdening the system (this type of map can be quite processor-intensive).

The more segments the plane has, the more retailed the terrain will be. We may need to increase this later, but avoid the temptation to use too many segments as this is likely to crash the system.

Next, we will apply a displace modifier to the plane (Modifiers > Parametric Deformers > Displace)

You will not notice any immediate change to the shape of the plane because we've not told the software what shape the displacement will be or the strength of the displacement.

The shape of the displacement will come from the height map we created earlier.. To apply it, click on the Map button in the Image section of the modifier's properties. Select Bitmap from the list of maps and navigate to where you saved your height map.

Again, you will not see a difference in the shape of the plane because we have not set the strength of the modifier.

Change the strength to 10 in the modifier properties (just above where you set the map). Your plane should now start to resemble a section of terrain.

Try changing the strength to see how it effects the terrain. Try to avoid extremes as it will start to look unnatural (unless you are trying to make the surface of the asteroid in the film Armageddon).

Now we have a terrain that has realistically random bumps, but the edges stop abruptly and spoil the scene. To edit the shape of the terrain, all we need to do is edit the image.

Open the height map image in Photoshop and select a very large soft brush (I am using 300px wide, 0% hardness). Use the brush to paint a rough black edge on the image.

Save the image and go back to 3DS Max. If you have saved over your original height map using the same file name, you should see that the scene has updated to reflect the changes.

If not, reapply the map by clicking in the map button of the displace modifier properties.

Try rendering the scene. You should have a realistic terrain which can be easily modified by editing the image map.

If the terrain looks a little blocky, you could try changing the segments of the plane (but try not to overdo it).