View source for Terrain Tutorial
← Terrain Tutorial
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 the [[Terrain]] article. To follow this tutorial, you need the <code>Data/Tutorial/world/Terrain.wld</code> file that is included in the C4 Engine distribution. To enlarge any of the screenshots below, click on the thumbnail icon below the image. == Step A: Open Terrain.wld == Open <code>Data/Tutorial/world/Terrain.wld</code> in the [[World Editor]] by typing Ctrl-O or by entering <code>world world/Terrain</code> into the [[Command Console]]. The World Editor should contain a nearly empty scene that looks like the screenshot shown in Figure 1. A skybox, infinite light, and physics node have already been added to the world. [[File:Terrain1.png|thumb|center|960px|'''Figure 1.''' The terrain tutorial world looks like this when it's first opened in the [[World Editor]].]] == Step B: Draw the Terrain Block == Select the Terrain Block tool in the Terrain Page under the Earth tab. 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 shown in Figure 2. [[File:Terrain2.png|thumb|center|960px|'''Figure 2.''' When a new terrain block is drawn in the editor, a dialog appears to let you specify a height map and configure other settings.]] Select '''Import TGA Height Field''' from the '''Terrain Builders''' list. We are going to initialize the terrain block with height data from a grayscale <code>.tga</code> file. For the '''Height field image file''' setting, select the file <code>Tutorial/terrain/Terrain.tga</code> (which is located inside the <code>Import</code> folder). 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 shown in Figure 3. [[File:Terrain3.png|thumb|center|960px|'''Figure 3.''' The initial form of the terrain is generated from the input height map.]] == Step C: Draw a Bridge == Type Ctrl-4 to make the Perspective viewport fill the editor window. Hold in the right mouse button in the Perspective viewport and use the WSAD keys to fly the camera closer to the terrain. Steer to the right slightly so that the small gully near the right end of the terrain is centered in the viewport as shown in Figure 4. [[File:Terrain4.png|thumb|center|960px|'''Figure 4.''' The Perspective viewport is centered on a small gully that we're going to draw a bridge over.]] Select the '''Additive Brush''' tool from the Terrain Page and make sure that the '''Cylindrical Brush''' shape is selected and the '''Horizontal Plane''' drawing 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 what is shown in Figure 5. You can undo with Ctrl-Z and redraw the bridge as many times as you like. [[File:Terrain5.png|thumb|center|960px|'''Figure 5.''' A bridge has been drawn across the gully with the additive terrain brush.]] == Step D: 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. Select the '''Secondary Blend Brush''' tool in the Terrain Page, and select the '''Spherical Brush''' shape. Make sure that the '''Blend Strength''' 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. The editor window should now appear as shown in Figure 6. [[File:Terrain6.png|thumb|center|960px|'''Figure 6.''' The terrain tools have been prepared for painting a different texture on top of the bridge.]] With the '''Secondary 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 Figure 7. You may undo and redraw the texture if necessary. [[File:Terrain7.png|thumb|center|960px|'''Figure 7.''' The texture on top of the bridge has been changed with the secondary blend brush.]] Now reposition the camera so that you can see beneath the bridge. Change the drawing plane to '''Follow Surface''' in the Terrain Page as shown in Figure 8. Click on the leftmost texture in the secondary texture set again, and select the brown dirt texture map. [[File:Terrain8.png|thumb|center|960px|'''Figure 8.''' The terrain tools have been prepared for painting a different texture beneath the bridge.]] 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. You can use multiple brush strokes or drag the brush back and forth to make the path wider. The scene should look like the image shown in Figure 9. [[File:Terrain9.png|thumb|center|960px|'''Figure 9.''' The texture beneath the bridge has been changed with the secondary blend brush.]] == See Also == * [[Terrain]] * [[Terrain Palettes]] * [[World Editor]] [[Category:Tutorials]]
Return to Terrain Tutorial.
Retrieved from "http://c4engine.com/wiki/index.php?title=Terrain_Tutorial"
About C4 Engine Wiki