This project is read-only.
Spanish Version

Creating terrains using 3D Studio Max

Introduction

In this tutorial we will learn how to create terrain models for our XNA demos. Terrains are usually created using code while loading, or dynamically while the game is runing. BattleField Bad Company uses an advanced terrain system in which the terrain is modified during the game because of the explosions that take place. You don't always need such an advanced terrain generation system, and so you can create it first and then load it directly onto the Content of your project. This is precisely what we will see in this tutorial.

Let's start

First thing that we are going to need is a texture for our terrain. You can either create it yourself or get it on the internet, for this example we are going to use this one:

Landscape.jpg

The next thing we will need is a height map. This map uses black to represent minimum height and white for maximum height. We are going to create this height map using Photoshop.

We start Photoshop and open a new file, 512x512 since our terrrain is going to be square:

Image1.jpg

Next we paint the background black so that it will all be initially at sea level:

Image2.jpg

Now we use the paint brush to draw the parts of our terrain that we want to be higher. We should choose an airbrush to that our terrain will be smooth.

Image3.jpg

I recomend that you make a black margin, so that when you put the camera in the center you will never see the end of the terrain since the mountains will be in our view.

heightMap.jpg

Now that we have the textures that we needes, we can use 3D Studio Max to finish. Lets create a plane in the center of the world. For this we need to go to Create in the menu to the right, and select Geometric, where we will see a button that says Plane.

Image4.jpg

We click on this button, and while pressing Ctrl we can create a plane.

Image5.jpg

To make sure that it is in the center, we can right click over the Move button on the upper toolbar, and set all the values to 0.

Image6.jpg

Now let's go to the Modify tab. Below are the plane's properties, which we are going to modify in order to create more vertex. We modify the length segs and the width segs – here I use 40 for each, but you can change this depending on the terrain's size and on how smooth you want the terrain to be.

Image7.jpg

Next we go to the Modifiers list, where we add one to out Displace plane:

Image8.jpg

Next we apply the heightMap that we created using Photoshop to the Map (Properties).

Image9.jpg

Image10.jpg

We adjust the Strength to the height that we want for the white pixels:

Image11.jpg

Now that we have created out terrain, we just need to give it a texture. We need to open the material editor (the easiest way to do that is by pressing the 'M' key). Any default material, we select Maps and add a texture to the diffuse channel.

Image12.jpg

Image13.jpg

Image14.jpg

To add the texture to the plane we need to follow these steps (first select the plane):

Image15.jpg

Now we are done! The only thing left to do is to export the model as fbx or whatever format you want to use.


Traslated by Juliet R. Moreiro Bockhop

Created by Javier Cantón Ferrero.
MVP XNA-DirectX 2007/2009
MSP 2006/2009
Date 17/10/2008
Web www.codeplex.com/XNACommunity
Email javiuniversidad@gmail.com
blog: mirageproject.blogspot.com

Last edited Oct 18, 2008 at 3:53 PM by khronos, version 3

Comments

No comments yet.