World Machine to UE4 using World Composition

From Epic Wiki

Overview

Author: ( )

     Creating worlds can be a long and detailed process. The time it takes to create worlds can be lessened with the proper steps. The process covered below creates tiled terrains in World Machine, exports them in the correct format with weightmaps, and imports them into UE4 using the world composition tool. Feel free to edit any information that is inacurate or add new information that may be relevant.

Terrain Creation in WM

     Terrains can be created in many different programs and can even be created in UE4 itself. For this tutorial we will be using World Machine to create every part of the terrain. Below is the process of creating a quick terrain with an 8km by 8km size when imported into UE4.

Generators

     In world Machine there are multiple ways to create terrains. One way is a procedural way using perlin or any other kind of noise generators. Another way is to import a heightmap created in another program as a basis. For the purposes of this tutorial we will be using the noise generators. Follow the steps below to create a terrain using a generator.
  1. Clear the world area to start fresh.
  2. Drag an advanced perlin noise device into the world.
  3. Double click on the device and change the parameters around to get the terrain you want.

Natural Processes

     One of the major features of World Machine is the natural processors. These include erosion, thermal weathering and more. These give your terrains that real world look. Follow the steps below to add erosion to the terrain.
  1. Drag an erosion device into the world.
  2. Connect the ouput of the advanced perlin noise device to the erosion input.
  3. Double click on the erosion device and edit the settings to get the look you want.

Terrain Export in WM

    To export the terrain from World Machine follow below. The export process is ran once exporting multiple files used for weightmaps for textures as well as the main heightmaps.

Tiled Build Setup

    Under "World Extents and Resolution" you will see a "Tiled Build Options" tab (This option is only available in World Machine Professional). Set the following options.
  1. Tile Resolution - Custom 2017 x 2017
  2. Tiles per Side - 4 x 4
  3. Blending Percentage - 100%
  4. Share edge vertices - tick
  5. Flip Y-axis orientation - tick

Tile Build Options.png

General Setup

Under the "General Setup" tab make note of the maximum elevation used. You can change this to your needs but remember that number, it will be used when importing into UE4.

World Machine General Settings.png

Height Output Setup

     Ensure the final height output is attached to a Height Output node. Ensure the settings follow the settings below:
  1. Filename - Filepath/Planet_Name
  2. Participate in tiled builds - tick
  3. High Precision - RAW16

Height Output Settings.png

Weightmaps Setup

     Setup whatever weightmap selections you wish to use. Follow the steps below to setup weightmaps based off terrain angle.
  1. Create 3 Select Slope Nodes
  2. Attach the Primary Output node to each select slope input node.
  3. Set the angle selections for each select angle nodes.
  4. Attach the outputs from the select angle nodes to a height output node.
  5. Set a distinct name for each output and make sure it is tileable. Below are some screen shots for each step.

World Machine Node Setup.png Select Angle Node.png Weightmap Output Settings.png

Build

    Now just click the tiled build option and let it run.

Terrain Material Setup in UE4

     The material for the terrain should be setup first. Follow the steps below to setup a terrain ready to accept the weightmaps exported earlier.
  1. Create a new material in UE4.
  2. Create a Landscape Layer Weight node for each weightmap you exported from World Machine. In the example in the previous section we exported 3 weightmaps based of High, Mid, and low angles.
  3. Name the Layer Weights something you will remember and can associate with the weightmaps exported from World Machine.
  4. Connect the output of the layer you want on the bottom to the "Base" input of the layer you want in the middle.
  5. Connect the output of the layer you want in the middle to the "Base" input of the layer you want on top.
  6. Connect the output of the layer you want on top to the "Base Color" input on the material node.
  7. Drag the textures you want to use for each layer into the material editor.
  8. Connect the outputs of the textures to the associated "Layer" input on the landscape layer weight nodes.
  9. Add a Landscape Layer Coords and attach the output to the "UVs" input of each texture node.
  10. In the Landscape Layer Coords set the tiling to whatever you want. Start with 25 and go from there.
  11. If you wish to use Normal Maps for the textures duplicate the process above. Instead of connecting the output of the last layer weight node to the "Base Color" input, connect it to the "Normal" input on the material node.
  12. Below is an example node structure.

Landscape Material.png

World Composition in UE4

     World composition allows smaller chunks of the planet be loaded at runtime when the player is close enough to that chunk. Below are the steps to get the terrain into the world.

Persistent Level Setup

    To setup the persistent level follow the steps below:
  1. Create a new level with a sky-box pre-built or not.
  2. Save the file with the Planet or location name.
  3. Open the world settings and check the box labeled "Enable World Composition"

UE4 World Settings.png

Tiled Landscape Import

    To import a tiled landscape follow the steps below
  1. Open the levels window.
  2. Click the Levels drop down menu in the upper-left of the levels window.
  3. Select "Import Tiled Landscape..."
  4. Click the "Select heightmap Tiles..." button.
  5. Navigate to the folder where you saved the raw heightmap images from World Machine
  6. Select all the tiled files. (e.g. Planet_Name_x0_y0)
  7. Change the Z scale. Times the world height used from World Machine by 0.1953125 and enter that number in Z scale.
  8. Select the Material created earlier. Once selected it should give you the weightmaps option.
  9. Now click the "Select Weightmap Tiles..." button.
  10. Navigate to the folder where you saved the raw weightmap images from World Machine
  11. Select all the tiled files for each weightmap. (e.g. Planet_Name_HighAngle-x0_y0)
  12. Then click "Import"
  13. Select all the Planet_Name_x#_y# levels in the Levels window
  14. Right click and select load to see if the imported properly.
  15. Below are some images of the process.

UE4 Levels Window.png UE4 Tiled Landscape Import.png UE4 Tiled Landscape Import Final.png UE4 Levels Window Level Load.png

Terrain in UE4

    Below are the images of the terrain fully loaded into UE4 using the process above.

UE4 Terrain in Engine 2.jpg UE4 Terrain in Engine.jpg