Create Terrain using L3DT

From CryWiki

Jump to: navigation, search
About
Author nan0byt3
Skill Level Advanced
Compatibility All
Requirements Not specified.
Date Added Not specified.
Last Modified Not specified.

The purpose of this tutorial is to show other mappers how to use L3DT to produce nice looking terrain and generate terrain texture. Also it discusses how to import them at a 1:1 scale into the Editor. Importing the generated texture into Sandbox2 takes the guess work out terrain painting as you only need to paint detailed sections rather than the whole map. For this tutorial, we are going to create a terrain in L3DT and import it into Sandbox2. Both L3DT and Sandbox2 use a lot of memory, so don't start Sandbox2 until you need it.

Contents

Prerequisites

  • Sandbox2 Installed and Ready to use
  • L3DT Installed

L3DT Map Setup

In L3DT go to Operations→Calc Wizard or press Ctrl+W. This dialog has five options, but ill only explain the first type in detail.

Design/Inflate, as its decription says, is all-singing and all-dancing. It generates a design map where you can change aspects of the heightfield before its generated. Alternatively you can start with a blank Design/Inflate. We are going to go with Design/Inflate. After selecting Design/Inflate, the Design Map Size is shown.

The X and Y values are the subdivisions on the grid. The horiz scale is an important value because if you want the map to look exactly the same in Sandbox2 you need to choose the same value in both Sandbox2 and L3DT. A horiz scale of 1 or 2 is recommended. I have not tried to make a sandbox map with 0.5 scale.

Design Map Parameters is the next dialog. The sliders define how the Design map is generated. Don't set the erosion too high as it takes a long time. Tropical is a good default climate with nice textures. Click Next when done.

Next you'll see the Design Map Brush dialog. You can Edit the design map using the edit tool if you have either too much or not enough land. Check the Altitude checkbox and set it to either 1 or -1 and also check the relative checkbox. This moves parts up or down, without losing the randomness. Don't worry about getting it perfect here, most of the editing is done after the heightfield is generated.

Here's the result:

Heightfield and Water Map

Run the Calc Wizard again, and this time heightfield will be selected. Click Next and it will generate according to the sliders set in L3DT Map Setup. After it has finished generation the vertical scale needs to be set to a value that can be used in sandbox. In Operations→Heightfield→Change vert. scale... look at the Altitude range (m).

Round the value off so there are no decimals. This is the height scale you will set in sandbox when you import the heightmap.

Now the water map needs to be generated so when you edit the heightfield the water level will be visible. Run the Calc Wizard, and after making sure the water map is selected press Next. Clear existing WM should be checked. Auto- flood sea/lakes takes a while and isn't needed if there are no sea or lakes. Press Next and then OK (skip the advanced settings).

After the water table has been generated switch back to the heightfield using the Sel Map button on the toolbar. Double click the heightfield to change back.

Editing the Heightfield

Go to Operations→Heightfield→Edit heightfield in 3D and allow it to load Sapphire.

WSAD moves the camera horizontally, E and R moves it vertically. Click and dragging the right mouse button rotates the view. The sphere following the mouse is the terrain brush, and can be resized with the mouse wheel. Experiment with the various tools to reshape your terrain as you see fit.

A few things to remember:

  1. Use the Edit→Backup and Restore before making any major changes, as there is no undo function. If you make the highest mountain higher or lowest point lower the vertical scale histogram will need to be rounded off again.
  2. The water and heightfield don't auto update after editing in Sapphire, so after editing click Exit or press ESC (dont worry, changes aren't lost), run the Calc Wizard and recalculate the water map, making sure Clear Existing WM is checked. This updates both the water map and heightfield to show your edits.

Prepare for Export

Generate Attributes

Once you have your heightfield the way you want, run the Calc Wizard again, select Attributes Map and press Next. This map defines what parts are sand, grass, cliff face etc. If there are parts not looking right (cliff where there should be sand) you can paint the desired attribute on the map. Alternatively you can go back to the heightfield and smooth out parts, but remember that more detailed textures will get painted on top of this in sandbox.

Generate Final Texture

Now you have everything the way you want its time to render the last of the maps and the final texture. Go to the Calc Wizard and check Terrain Normals and Light Map and press Next. In the light mapping dialog set the Elevation to 90°, the Amb. colour to Half Gray ( R128, G128, B128 ) and drag the Sun/Ambient ratio all the way to the left (all ambient no sun). This makes the final texture look right once imported into sandbox. Press Next again.

In this next dialog uncheck Cast shadows and Water effects. Press OK.

Now to make the final texture. Go to Calc Wizard again, check Texture Map, and press Next. Make sure the top three checkboxes are turned on. Max antialiasing can be bumped up to taste. Press OK and wait while your final texture is generated.

Export Maps

Now that you have your final texture is time to export the heightfield and the texture map and import them into the Sandbox2. Go to File→Export→Export Map... and select the heightfield. Choose the RAW format and a location to save the texture. Press OK and the heightfield is saved.

Now go to File→Export→Export Map... again and this time select the texture map. This time select the BMP format, set a location and finish.

Before you close L3DT write down the Altitude range and the Maximum Altitude from the heightfield, you'll need them in the next step. Also make sure you save the project first, in case you want to tweak things later.

Importing Heightmap into Sandbox2

Now start up the Sandbox Editor, and make a new map with a resolution the same size as you made in L3DT (in my example 2048x2048 with 1 meter per unit).

Next open Terrain→Edit Terrain. Set the max height to the Altitude range, and the water height to the Altitude range minus the Maximum Alt (you wrote them down right?)

Once you have done that you can now import the .RAW file you made with File→Import Heightmap. Don't generate a surface texture just yet or you will get the default grass layered on top of your new texture.

Tiling Texture

This step involves determining what size tiles you a using aroung the map, then splitting the .BMP texture into the tiles, and resizing each piece to the correct size for that tile.

To start with go to Terrain→Export/Import Terrain Texture. There you get this dialog which tells you how many tiles the texture has and the size of each tile.

There is another tutorial that details the resizing of tiles so i wont go into that here. Now that you know how many tiles to divide the texture into its time to use your favorite image editor to cut the .BMP texture into tiles. Remember that if you have tiles at different resolutions, you need to resize that particular tile to suit. For example if the top left tile was 512, the texture tile needs to be resized to 512x512.

Resizing in Photoshop
Resizing in Photoshop


Note
Keep a standard naming pattern for the tiles, say a1.bmp for top left, a2.bmp for top right and so on.

Import Tiles

After you have split the texture into tiles and resized them appropriately, Go back to the Export/Import Texture dialog.

Then you can import them by clicking the little dots next to where the file path is in the image. Select a1.bmp (or whatever your top left is) and press save (it comes up with a dialogue asking if you want to overwrite, just say yes, your tile isn't overwritten unless you press export), then select the top left tile and press Import. Do the same for each of the other tiles. After you have done that press close.

Remove Default Texture

  1. Go to Terrain→Texture
  2. Select the Default layer and click Edit Surface Types
  1. Select Default and then click Material Editor
  1. Choose Materials/presets/surfacetypes/mat_invisible
  2. Close the Material Editor and click Pick Selected
  3. Press OK
  4. Click Load Texture and choose 64grey.dds
  5. Exit the terrain layers editor.

Final Generation

Now all thats left to do is File→Generate Surface Texture.

I found setting it to twice the map size looked nice. From here i recommend you add in each texture layer one at a time, making sure each layer has a different number and surface type. After importing all the layers from another map the dreaded *mix* appeared (the default green grass grew on my nice cliffs!).

Results

Personal tools