Creating custom terrain with Worldmachine

From Valve Developer Community
Revision as of 16:51, 17 August 2020 by 9yz (talk | contribs)
Jump to: navigation, search


Example of finished terrain exported from World Machine.

World Machine is a very powerful tool for creating realistic terrain. Thanks to its ability to export heightmaps, you can use terrain generated in World Machine and import it into Source using displacements.

Note.png Note: This method has only been tested in <Counter-Strike: Global Offensive> Counter-Strike: Global Offensive. However, it is likely it will work in other source games as well.
Note.png Note: This tutorial assumes you already know the fundamentals of World Machine and have created the terrain you want to export along with the megatexture you want to apply to the displacements

Exporting the Bitmaps

Screenshot showing the required nodes to export your bitmaps.

To import this into Source, we will need 3 textures: a Heightmap, a Diffuse texture, and a Normal Map. To get a normal map, add a "Normal-Map Maker" device (located under the "Converter" tab). To the input, connect your primary terrain heightmap. From the normal map output, connect a Bitmap Output (found under the "output" tab). Don't forget to double-click on the bitmap output and set a file destination.

Next, we need a heightmap. Connect your primary terrain heightmap to a Height Output node (located under the "output" tab). Double click on it, set your file location, and change your file format to BMP. This is required to import the heightmap into Terragen.

Finally, we need to export the megatexture. Connect the output of your texture to a Bitmap Output and make sure to set your file path.

Go to File -> Export Terrain Files and press "Export All." If you are prompted to build the files, press Yes.

Generating the displacements with Terragen

Screenshot showing the suggested settings in Dispgen
Note.png Note: This tutorial assumes you already have Dispgen downloaded and running.

Next, we need to use Dispgen to create our terrain. The best settings are to use 16384 units for the X and Y size, 4096 for the height, and 256 for the X and Y triangles. In addition, check the box next to "Adjust Terrain to minimize vertical texture stretching" and uncheck "Run Smoothing." You can leave the material name alone, as we will be making a custom texture later. Finally, Define your heightmap and VMF Output file and press generate!

Creating the texture

	$basetexture "custom_9yz/Worldmachine/proj1"
	$bumpmap "custom_9yz/Worldmachine/proj1_normal"
	$surfaceprop Rock

	$detail "detail/detail_rock001"
	$detailscale 8
	$detailblendfactor 0.47

Applying the texture and finalizing

Screenshot showing the suggested settings in Dispgen