Creating landscapes in UE4 manually using in-editor Sculpt Tools takes time. But you can speed up this process by using heightmaps.
In this guide you will learn everything you need to know about heightmaps in UE4.
A heightmap is a grayscale texture that stores landscape height information. Black color is low elevations or valleys and white color are high elevations or peaks. All landscapes in UE4 rely on heightmap data to create the terrain.
Gray color that represents the middle of the heightmap is:
Here is what a heightmap texture will look like:
Here is what it looks like after import in UE4:
When exporting heightmaps for UE4, follow this format:
There are many different ways to create heightmaps.
If your Landscape's Overall Resolution is 4033px by 4033px then the size of your landscape is 4033 meters by 4033 meters.
You can find overall resolution of your landscape when you create the landscape in UE4:
If you have an existing landscape, select it and go to Details panel:
When you create a heightmap in external software you can define the texture resolution. For example in Photoshop:
You should use heightmap resolution listed in the Epic's Recommended Landscape Sizes.
So if you are in Photoshop, you create a new document with Width and Height listed in Overall Size (Vertices) column.
I've seen many people recommend using power of 2 texture sizes but that has created some issues.
Reason to use Epic's Recommended Landscape Sizes has to do with a stretching effect around the edges of landscapes if using power of 2 heightmap sizes.
Here is an example of a heightmap created in Photoshop at 2048x2048 texture resolution and imported into UE4. This produces a stretching effect around the landscape edges and it usually means your heightmap resolution is wrong.
When creating heightmap resolution using the above Epic's Recommended Landscape Sizes such as 2017x2017 heightmap resolution. The landscape texture produced correct results:
My conclusion to use Epic's Recommended Landscape Sizes and not power of 2 texture sizes.
However, you could still use power of 2 texture sizes with an adjustment.
Yes, you can still use power of 2 texture sizes.
What are power of 2 sizes?
Fix I found is to remove 1 component from the imported heightmap prior to creating the landscape. For example, importing 2048x2048 heightmap will give you Number of Components set to 17x17, which will create the stretched edge around the landscape:
If you reduce it by 1 component to 16x16, it will work as supposed to:
This applies for heightmaps generated in Photoshop and from real-world data websites such as Terrain.Party.
I haven't tried this with heightmaps generated from World Machine, World Creator or other 3rd party software yet.
If you are getting blocky landscape after heightmap import such as this:
It is because you are using 8bit heightmap instead of 16bit heightmap.
Important: Heightmaps must be created and exported as 16bit grayscale textures (png or raw file type).
However it does produce an interesting effect that could be used for a specific style.
To import heightmaps into UE4, go to Landscape Mode (Shift + 3) > Manage and click to Import from File:
Browse to the heightmap under Heightmap File:
The Section Size, Sections Per Component, Number of Components and Overall Resolution will be prefilled based on the heightmap resolution:
I usually keep the defaults that UE4 gives me. But if you know what you are doing and have some understanding of all these properties, you could adjust them.
Once you are ready, hit Import:
Fit to Data will reset the size back to what UE4 thinks is best:
On heightmap import it is very common to get the height of the landscape that is too intense:
To fix this you need to lower Scale on Z.
Select the landscape and go to Details panel. Under Scale, lower the Z value. Make sure you have the Uniform Scale icon unlocked:
Also, during the import screen for the heightmap, you could lower the Scale Z there prior to creating it:
You can export an existing heightmap from UE4 at any time. This will generate a 16bit PNG file of your landscape.
Then you can open this texture in Photoshop, Gimp or any other image-editing software:
Reimport a heightmap to an existing landscape:
The reimported heightmap should match the size of your existing heightmap.
Learn EVERYTHING you need to know for how to create/sculpt landscapes and create/paint landscape materials entirely in UE4 without any external software with "UE4 Fundamentals Vol.2: Landscape Essentials".
All content on this website is copyrighted ©2008-2020 World of Level Design LLC by Alex Galuzin. All rights reserved.
Duplication and distribution is illegal and strictly prohibited.
World of Level Design LLC is an independent company. World of Level Design website, its tutorials and products are not endorsed, sponsored or approved by any mentioned companies on this website in any way. All content is based on my own personal experimentation, experience and opinion. World of Level Design™ and 11 Day Level Design™ are trademarks of Alex Galuzin.
Template powered by w3.css