Beginners Terrain Tutorial

This is the starter document : starter.zip
Here is the finished document. Probably best to do it yourself though! : continue.zip
Once you've downloaded the starter doc, open scene_1.

Surface Detail

The new surface detail tool allows you to place meshes directly onto a terrain. This allows for faster rendering, and easier decoration of a terrain.

I have added some meshes to the scene to get you started - feel free to add more meshes to experiment with surface detail.

Setting up Surface Detail


Adding a Map

In order to allow surface detail painting on our terrain mesh, we need to add a surface detail map.
Click on the terrain in the main window. Then, right click and select "Edit Materials". In the window that appears, select the "Surface Detail" tab. Click on the new map icon below the "Surface Detail XYZ" box (highlighted below).

This will create a new .dxxyz file, and select it for you. The DXXYZ file will store the positions and types of the meshes that we will paint on with the surface detail tool.

Billboards

For detail like grass - things that can be represented well with sprites - we can use billboards. I have included a billboard texture called Grasses.dds. Select this from the dropdown list called "Billboard Texture".
This texture contains 4 images, split into 4 sections. To make sure that DXStudio places each grass piece correctly, we need to tell it how it is split. The image below shows the settings we will be using.

Since there are 4 images, we set the Texture Split to 4 (2x2). We kept the size at 1.00 - this will keep the billboards at their default scale. I set the sway to 0.5, so that the grass will sway gently, as if in a breeze.

Painting Billboards
Click OK ok the Material Editor window. This should return you to the scene. Click on the terrain object. Look at the bar at the top - select the Tree icon and a menu should appear - it should look like the following. We are interested in the part highlighted in red.

Make sure that the "Add Billboard" radio is selected. "Add Mesh" will not work yet, as we have yet to set up meshes for our mesh. We will do this soon. The slider allows you to choose which billboard to draw. Since we have 4 billboard images, this goes from 1 to 4. Leave it on 1 for now. The size box allows us to specify a custom size for the billboard. We'll use defaults for now.
Click the tree icon again; this will close the menu. Now, hover over the terrain with your mouse. The cursor should be a cross instead of the normal pointer. To paint billboards, click and move the mouse around. You should see a little plus icon, and the billboard will appear. Try changing the billboard that we are using (in the Tree menu).
After some painting, you should end up with something like this.


Meshes

For objects like trees and rocks we need to use meshes instead of billboards. Make sure the Material Editor is open ( right click on the terrain object, click Edit Materials ). Make sure the Surface Detail tab is open.
Make sure that Surface Detail has been set up ( see Adding a Map ).
Your window should look something like the following. I have highlighted the area we are interested in now.

Here's a brief description of what each column means.
  • Value(G) - This is the identifier that is used to select which mesh to paint when painting.
  • Mesh ID - This is the ID of the mesh in the scene that will be added.
  • Align to Normal - If selected, objects will align themselves to slopes.
  • Sway - If true, this mesh will sway as if in a breeze.
  • Physics - If true, this mesh will have physics enabled on it. On smaller objects, this may not be desirable.

Adding Meshes
Click the plus icon. The window shown below on the left should appear. Set it up so that it looks like the one on the right. Select Tree from the dropdown box, and check "Sway". Each time you add a mesh, make sure the Color Index is unique.

Click OK. This will return you to the Material Editor. Click OK to close it and return to the scene.

Painting Meshes
Select the terrain object. Then click the Tree icon on the toolbar at the top. The menu below on the left should appear. The bit we are interested in is highlighted in red.
Make sure the "Add Mesh" option is selected. Also make sure that "tree" is selected in the drop down box. You can also specify a Size value, and a Rotation value. We will use defaults for now. Once your menu is set up it should look like the one on the right.

Click the Tree icon again. This will close the menu. Now hover over the terrain with your cursor. It should show a cross. To paint trees, click and move the mouse around. The trees should appear where your mouse is. It should look something like this after some painting :

Try adding some more meshes to the Surface Detail. Make sure you give each one a unique index. Eventually you can get something like this : (Note, I added an environment)


Erasing

If you want to erase billboards or meshes, go to the Tree menu, and select the "Eraser" radio button. You can also select the radius of the erasing. To erase, just click and move the mouse around the area you want to clear. The menu will look like the image below. Relevant area is highlighted.


Pathing

As well as adding trees and other details, we can draw paths (or any other type or image) on the terrain.

Setting Up Pathing

To use paths, we need to have a Multitexture. To help, I have added a Multitexture already.

Painting Path

Click on the Spraycan icon on the toolbar on the top. It will open the following menu. Set it up so that it is as shown below.

The color box underneath "Paint Texture" can be set to any color. If you are painting color channel, you can set the color that we will paint here. You can also set the opacity if you are painting alpha channel. We are only going to paint alpha, so we should just set the opacity of the color to 255.
We only want to paint the alpha channel (which will reveal the path), so make sure that "Color Channel" is unchecked, and "Alpha Channel" is checked.
Set the "Multitexture Index" to 1. This will paint the texture we want.
The brush diameter allows you to draw thinner or thicker paths. Set this to 12 for now.
Close the Spraycan menu by clicking on the icon again. Then, click and move the mouse around on the terrain, and path should appear. After some time, it should look something like this.


Erasing Path

To erase a path, go to the Spraycan menu, and make sure that the opacity of the Color (under Paint Texture) is set to 0. To do this, click on the color box underneath Paint Texture, then drag the opacity slider to 0 on the Color Dialog that pops up. Then paint over the areas you want to erase. To go back to painting, set the opacity to 255.

0 comments:

Post a Comment