Terrain Tutorial
From C4 Engine Wiki
This tutorial guides you through the creation of a new terrain block and some basic terrain editing operations. For more general information about the terrain tools, see Editing Terrain.
To follow this tutorial, you need the Data/Tutorial/world/Terrain.wld file that is included in the Data.zip distribution.
To enlarge any of the screenshots below, click on the thumbnail icon below the image.
Contents |
Step 1 — Open Terrain.wld
Open Data/Tutorial/world/Terrain.wld in the World Editor by typing Ctrl-O or by entering world world/Terrain into the command console. The World Editor should contain a nearly empty scene that looks like the screenshot below. A skybox and depth light have already been added, and the Terrain page is already open.
Step 2 — Draw the Terrain Block
Select the Terrain Block tool in the Terrain page. In the top viewport (the upper-left viewport), click on the origin and drag out a box that is 4 large grid squares on each side. The grid settings have been set up in this world so that each small grid square is 10 meters, and thus 4 large grid squares corresponds to 400 meters (or about a quarter mile). When you release the mouse button, a dialog box appears as in the following screenshot.
Select "Image TGA Height Field" from the Terrain Builders list. We are going to initialize the terrain block with height data from a grayscale TGA file. For the "Height field image file" setting, select the file Tutorial/terrain/Terrain.tga. This file contains the height field used in an old demo level. To match the same vertical scale as in the demo, enter 80.0 in the "Height scale (distance)" setting. Click OK, and after a couple seconds, the scene should appear as follows.
Step 3 — Draw a Bridge
Select the Additive Brush tool from the Terrain page and make sure the Cylindrical Brush shape is selected and the Horizontal Plane is selected. We are going to draw a horizontal bridge connecting the left and right sides of the small gully visible in the perspective viewport. With the Additive Brush selected, click in the perspective viewport on one side of the gully at the height where the vertical center of the bridge should be. Hold the mouse button down and drag to the other side of the gully. The result should look like the following screenshot. You can undo with Ctrl-Z and redraw the bridge as many times as you like.
Step 4 — Apply Different Textures
Position the perspective viewport's camera so that you have a better view of the top of the bridge you just created. (You can hold in the right mouse button to switch to the free camera tool and use the WSAD keys to move.) Select the Blend Brush tool in the Terrain page, and select the Spherical Brush shape. Make sure that the Texture Blend slider is moved to the right so that a high percentage is displayed. This slider controls how the primary and secondary texture sets are blended together, with 0% being only the primary set, 100% being only the secondary set, and anything in between being a blend of the two sets.
Click the leftmost texture in the secondary texture set. This is the texture applied to top-facing horizontal surfaces. Click on the top-right texture from the palette that appears to select a gray cinder/stones texture map.
With the Blend Brush tool still selected, click on one end of the top of the bridge and drag to the other end. The ground texture should change to stone as shown in the following screenshot. You may undo and redraw the texture if necessary.
Now reposition the camera so that you can see beneath the bridge. Change the Plane to "Follow Surface" in the Terrain page, as shown in the following screenshot. Click on the leftmost texture in the secondary texture set again, and select the brown dirt texture map.
Click on the ground close to the camera and drag the mouse down through the center of the gully. The brush will follow the terrain surface and change the texture of the surface beneath it. Your final scene should look like the screenshot below.
