Landscape - World Machine perfect integration
Approved for Versions:(please verify)
This is a workflow guide to use the powerful World Machine terrain generator to create, edit and change your landscapes in Unreal Engine 4. It's mainly about setting up your projects and terrain generation to have a seamless import/export pipeline.
Let's get started!
Create and edit a Landscape in Unreal
Start from a blank scene and press SHIFT+3 . This will bring up Landscape Tool menu'.
Creating the landscape
I recommend to use "recommended Landscape sizes" as a starting point, it will lead to a cleaner pipeline. If you already have a layed out scene, try to create a landscape that embed all your features using the recommended sizes.
Edit it a little bit, again for the sake of the example, it will be good to reach the maximum extent of the landscape: sculpt until the mountain slope doesn't grow anymore and dig until you reach the lower limit. WARNING : for scale Z=100 you've a range of -256m : +256m.
Now, you should apply a Landscape material (you can use Content Example - Landscape to get how to do it). Keep it simple, you need only two layers for this step: one will be the area you want to be edited by World Machine, the other is an area where you want to mantain EXACTLY the same height you've in Unreal Engine.
In my example, I want the RED area to be left unmodified by World Machine.
We're ready to export our data towards World Machine!
Select "Sculpt" sub menu in Landscape Tool, RIGHT CLICK on Heightmap and select "Export to file". Export your .png file where you want it to be.
Select "Paint" sub menu in Landscape Tool, RIGHT CLICK on the layer you want to export and select "Export to file". Export your .png file where you want it to be. Calling it "mask" or something like that it's a good idea.
Now we've everything we need to use World Machine to bring some beauty into our landscape...
World Machine setup
You'll need to be very careful when setting up your project in World Machine: stick exactly to the measurement you've in Unreal and you'll be good to go. Project settings and Heightmap output resolutions should be adapted to your data, I'll continue with my example.
Bringing in your Heightmap
Start World Machine and bring immediately a File Input node in your node network. Then open it and load you heightmap.png.
Now it's time for some hardcore measurement party: in the width-height input field of "File Input" dialog put THE EXACT EXTENSION OF YOUR UE4 LANDSCAPE
For me it's 505mx505m...
Setting up your project
Then setup your project settings to match extensions and height of your UE4 landscape.
Open "Project Settings" and modify extensions data under Render Extents and General Setup tabs.
For me it's 505m under "Location" in "Render Extents" tab and -256:+256 in "Terrain Altitudes" in "General Setup"
If you think that from now on, exporting data via the output node will give you a perfect matching terrain in UE4, well, you're right.
You can give it a shot by exporting this unchanged heightmap and creating a new landscape in Unreal4. It will match perfectly to what you've done!
To try it, just RIGHT CLICK on the Height Output and select "Write output to file".
World Machine editing
Masking your landscape