Creating a Real-time Photo-real Landscape Material in UE4 (Quixel)

Tutorial

Hi all,

​

I'm the lead dev on a WW2 hardcore FPS title called Hell Let Loose. You can check out the game at our website and on Steam.

​

I've said in a couple of places that I'll put together a bit of a guide on how to create a landscape material that presents well in-engine, works at real-time and gets close to photo-real in quality - that also uses Quixel Megascans. Our team is only made up of 6 full time devs (including every department), and all our maps are created by 1-2 people at most. The key to creating beautiful work in-game is to be careful in controlling each asset as it comes in and working to make them sit correctly together. There are a couple of other aspects that I may make additional posts on down the line (lighting/atmosphere, world building, foliage etc.).

​

The landscape material in action in our European theatre from an upcoming map.

​

Fundamentally, a good looking landscape material is going to be based on the reference you find and the amount of testing that can be done as you refine the look. I began using Unreal Engine in 2015 and before that had absolutely no experience with 3D art - so I want to encourage you that it's very possible to continue refining your work and pushing yourself to aim for a greater visual fidelity.

​

In that time, we've developed a pretty standard pipeline for creating landscapes that give us great flexibility in achieving a diversity of looks across a large 2km map. We knew that we needed at least 7-10 materials in order to quickly achieve multiple different looks. The layers have two purposes - the first is that they allow us greater creative control in quickly establishing a different location (mud vs grass vs cobbles) and the second is that they allow us to auto-spawn "grass" and other small objects per layer. This is a really quick and powerful way of painting in a natural environment without having to worry about the manual placement of smaller props.

​

To begin our landscape material, I think about the location of the level and begin looking at references in order to start breaking down the key looks. For us, that's often:

- Mud

- Dirt

- Flattened field grass

- Longer, wild grass

- Rubble

etc.

​

Below I've written out a guide that I'll iterate on and add to if people have questions. It's a complex process and has lots of nuance and other quirks to navigate in order to accomplish a good look in-engine. Often, the things that make the biggest difference are not what you'd expect (like scale of the texture as applied to the landscape).

​

Landscape Material Layer Setup:

  1. Set up your material in Quixel Mixer. I always use a 4m x 4m plane, as the detail quality remains high even at 2k when imported into engine. It also means that there is more unique surface area in the engine before it needs to repeat (ie. the texture repeats every 4m or so instead of every 2m). I also make sure to keep the lighting preset as Pisa within Mixer. While this is not the most accurate, the key is to keep consistency so that what you see in Mixer stays uniform. If you change the lighting setting a lot in Mixer, you'll end up with textures that look continually different with each import into UE4.
  2. Export the 3 textures from Quixel Mixer to the appropriate content folder in your project (ie. content/materials/landscape) using the following settings in Mixer. We export as PNG as it's the best format for UE4 (compression vs quality). I always export 4k as we can manually set the resolution lower in engine by changing the LOD bias in texture. It is important to flip the Y (green) channel in your normal as UE4 has it flipped by default. I normalize the displacement map as it creates stronger details that allow for crisper and more defined tessellation within the engine. Pay particular attention to the RDA map - it is one texture with the roughness in the red channel, displacement in the green channel and ao in the blue channel. If you're using a metallic landscape material, you may want to export out an additional map or potentially change displacement to metallic. Please note, these channels are laid out in a way to maximise texture budget. NEVER use the alpha channel in a texture, as it will end up costing 3 x the total texture memory than one entire texture and is never efficient.
  3. Drag your three textures into your landscape material and begin to set them up using the following guide. Image 01 and then image 02. Image 02 is designed to create a macro variation in color/diffuse throughout that material layer (ie. we use it to create larger patches of dead grass in our normal grass material). You can simply use image 01 as your guide and plug in the Albedo node straight in - instead of going up to the lerp. Depending on how complex you want to make it, you can also use this same technique to vary roughness, normal and all other properties of the material. The only property that does not function via lerp is displacement/tessellation.
  4. Navigate to your textures in your content browser in-engine and select the special/RDA map (it'll appear pink in the engine). Double click it and change the settings with the following in mind. Having changed the settings inside the texture itself, you will ALSO need to change the settings by clicking on the texture inside the material and editing them on the left hand side in the details panel. Make sure that EVERY texture is set as wrap inside the material and inside the texture itself. This is very important and will otherwise limit you to the use of 6 textures at most within the material.
  5. Additionally, to push the visual quality of the landscape we have tessellation enabled. This allows us to create a really integrated look and bring the surface of the landscape to life. I generally find that good use of tessellation and roughness can really break up the repetitive look of landscape materials.The tessellation set up within the material uses the following settings.
  6. Once you've set up several material layers in the landscape material, right click on it in your content browser and create a Material Instance. Then assign the MI to your landscape. If you open up the MI, you'll find each layer is separated out into groups and you can quickly throw in new textures to create new materials - as well as adjust a myriad of settings per material layer. See image 01 and 02.

​

The material that I just took from Mixer to UE4 is called dune_sand. You can see it in-action here.

​

I'll flesh this out more if people have questions. There's more advanced functionality here that we don't use - such as height blending or assigning material based on slope angle. We personally have adjusted our material to suit our exact use, but once you get a basic material underway you can quickly change the function of individual layers to suit your own needs.

​

When iterating out the materials, I always use unlit mode to check and make sure the darkness, brightness and saturation sits comfortably together. It's an old trick but it really helps you establish a balanced look across all the lighting conditions. I also recommend that when creating real-life locations you collect as much reference as possible and try and colour match in-engine. In the material we've set up there are controls for every material and texture that allow us to quickly iterate the look as fast as possible. You really don't want to have to touch the master material ever once you've created it as the shader rebuilds can be immense depending on your map size.

​

In addition, the landscape material will only be able to take you so far towards a great environment look. Something that always helps is adding variation through the use of decals (puddles) and mesh decals (tracks). The mesh decals can be placed via landscape spline which is about as close to a proper road tool as UE4 gets. I'd also recommend using the unlit mode as a constant way of checking how any added 3d assets sit within the world, and also continually check the relative scales of every model you bring in - as it will drastically effect whether or not the environment feels convincing.

​

Please ask any questions you may have below - I'd be happy to answer them!

​

Here is a link to the whole IMGUR album - complete with more images of the material in action.

Posted May 8, 2019, 9:20 AM UTC · edited

13825
smileymasterTrial and error until I have something playable.•

> NEVER use the alpha channel in a texture, as it will end up costing 3 x the total texture memory than one entire texture and is never efficient.

Thank you for this, I was wondering why nobody used this in pngs and I felt really smart having used them, but now that I know this I'll need to rethink my strategies.

12
HLL_maxOP•

Glad it helps! It's one of those small counter-intuitive nuances that really need to be explicitly stated.

7
[deleted]•

[deleted]

6
Cpt_TrippzIndieDev•

why does the alpha channel cost 3x the memory?

This is due to different texture compression methods, 3 channels will be compressed with DXT1 (8:1) while adding an alpha channel will result in the use of DXT5 (4:1).

It's related to DirectX, not UE4.

Here you can find a comparison table: https://docs.unrealengine.com/en-us/Engine/Content/Types/Textures/SupportAndSettings

Note however, that if you use alpha, that channel would receive the most memory and thus least quality degradation (its a lossy compression). The texture is stored as R5G6B5A8, with 8bits in the alpha channel, as opposed to 6 in G and 5 in R and B, respectively.

Sometimes it can be justified to use that channel for masks that could benefit from the quality increase.

Also, if packing your textures into 3 channels rather than 4 results in using more texture samples in your shader (e.g. you now have 2 textures instead of 1 in your material), your memory savings come at a shader performance cost. It's always something to keep in mind.

Btw. the green channel has a higher memory allocation than the red and blue channels regardless of which of those 2 compression methods are being used, it is therefore recommended to use it for your most detailed mask (usually roughness) as the information will be stored as 6 bits instead of the 5 in RB.

11
[deleted]•

[deleted]

2
HLL_maxOP•

Thanks for the brilliant reply. I was digging up the documentation in reply and saw that you'd beaten me to it! As you've identified, it's always a balance of pros vs cons - I'm sure someone somewhere will find use for the alpha channel.

2
awera•

I thought it was at most 2x (the same as another RGB texture)? I recall reading that from an Epic employee on the forums. Also Epic themselves use packed alphas in some of their example projects. And is commonly done if you don’t have 2 other channels to pack a separate packed texture with. It’s far more convenient when you have say 1000 assets all packed that way.

1
EthanBeMeHobbyist•

Here's a snippet from some design documents
https://i.gyazo.com/b9cdf8b681edd1effae69188e8d16b20.png

Configurations

(2k) DXT1 + DXT5 = 7.99MB (7 total channels)

(2k) DXT5 + DXT5 = 10.66MB (8 total channels)

(2k) DXT1 + DXT1 + DXT1 = 7.98MB (9 total channels)

*DXT5 being a texture that contains an 8bit alpha

1
Rispearsoch•

Fantastic tutorial thank you!

10
HLL_maxOP•

Pleasure - let me know if there are any issues you encounter!

4
TotesMessenger•

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

 ^(If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads.) ^(Info ^/ ^Contact)

3
CaptainKizy•

Looks incredible and great info! I work for a software company that deals in laser scans and photogrammetry - this looks very similar to what I see each day and is very realistic considering it's generated. Very impressed.

3
nvec•

Are you doing anything clever to avoid holes in the tessellation beyond what you've said above?

Was playing with landscapes a few weeks back with tessellation but it seemed to create a lot of small gaps where landscape components with different LOD resolutions met.

2
HLL_maxOP•

Ah, this raises a great point. Within the tessellation settings I set 50 as the bounds (in the tessellation settings in the material itself) and then in the details of the landscape itself and essentially try and increase the contrast in the displacement map (and I look at this in Quixel Mixer) in order to make sure there is uniform displacement across the whole texture. The greater the contrast of this map within the texture, the less you need to boost the displacement in-engine to notice it. Currently, while 20 is my default strength, we tend to use 5-12 at most. Boosting it far beyond those bounds can lead to tearing. I have to say it's very poorly documented and the crack-free displacement seems to basically kill all tessellation - which is why I avoid it. There are some clever things you will need to do that essentially cull the tessellation beyond a certain distance from the camera. The nodes are very dirty in my material and so I'll try and clean them up and post a screenshot. By using these nodes you can essentially cull the tessellation beyond 10m or so - leading to a much more optimised material.

2
g00zerther•

Great write-up! Thanks so much for sharing.

2
pzy64•

Thank you for this article. Amazing visuals!..

2
IlIFreneticIlI•

Great tutorial. Thanks!

"such as height blending or assigning material based on slope angle. "

Right now I am working on a landscape material using slope-blending and height maps (for puddles, other effects + displacement).

Whilst doing this I'm struggling to see how I can leverage the layer-blending system; is this at all possible using a slope-blend? Can I use the slope-mask to somehow tell the layer-blending nodes which networks to apply where? As it is right now, my landscape is basically one material, workable; not red, it's in the shit-brown shader range (lol) but I suspect I am just missing something obvious and thought to ask...

2
HLL_maxOP•

Hey! Realistically the practicality of it will always trump how smart the material is. I spent huge amounts of time trying to get the landscape material to do absolutely everything (slope blending, height maps etc) and in the end just decided that it was better artistically for me to segment out the materials and manually paint them than try and rely on it doing too much automatically (which tends to look very procedural in a not-organic way). I'll need to dig out the documentation - you can blend it so that each sub layer has specific ways of applying, but the further you go down those paths the more locked you are to the look and the less flexible the functionality is to alter.

2
IlIFreneticIlI•

Thank you very much for the detail OP and the reply.

I hear you on the kitchen-sink material.. :d Been there done that and I can appreciate the benefits of breaking everything out.

I've taken a few whacks at landscapes and have been able to get weight-blended (with mixed height-blending to work) but with the slope-mask, I couldn't see a way to plug that alpha into a layer-node that would have it blend less than the maximum number of materials..

Another question, just b/c you never seem to see this anywhere, but instruction-count? With your multi-layer approach, what you do run with? More just curious what the state-of-the-art is round the neighborhood.

BTW, for me, the texture-settings information is most-helpful. I was taken aback at how many things one can futz with...sigh..so much to learn. (and thanks again).

1
Polter_•

You are a life saver, thank you mate! +Rep

2
RichGo•

I've watched so many Quixel videos and Googled answers to what you laid out so cleanly. Seriously wish I found this a month ago. Thanks for taking the time to post this, it was a huge help. Can you show another snapshot of what is below image two or how you connected everything to the main material.

2
HLL_maxOP•

Sure thing. I'll try and take one and reply to this thread. Glad it was helpful!

1
mobile_hollow•

Was just looking for EXACTLY that and there you are, with all the answers I needed. Can't thank you enough for this mate

1
[deleted]•

[deleted]

1
OrdinaryKick•

Thank you for sharing your knowledge!

​

Is there anywhere else you posts that I might be able to check out? It's always refreshing to learn from someone who clearly knows their shit

1
salvat1n•

When actually painting the materials on the landscape do you use slope based mapping, or weight maps brought in from an external software or do you hand paint each area on your landscape? I understand it may be a mixture of two or all three but this is the decision that gets me the most.

1
HLL_maxOP•

We basically begin with a rough height map and mask set up that we generate in world machine after importing satellite date. It really only helps in breaking up the landscape before we begin - we've found it can only really take us so far towards a final product. Normally once we've imported we'll start to break it up into sections and begin placing props and sculpting/hand painting.

1
Ven_San•

Amazing!

Thank you for sharing this. other tutorials are welcome!

"Hell Let Loose " now is in my steam wishlist

1
HLL_maxOP•

Thanks so much for the support - I'm glad it was helpful!

1
Speirs_Easy•

such nice info, Max, thanks a lot, I have a quick question, since we have tessellation for this Landscape, I would like to know what kind of resolution and number of components you use for your terrain I mean the landscape setup, it looks like your map is 2km x 2km, could you help with this setup?, Thanks man, REALLY COOL INFO!

1
FaulerZauber•

What is that texture you use as "variation mask"? Also this is great, thank you.

1
FaulerZauber•

Also showing the whole blueprint and with more layers would be very helpful as it would give a better idea of the general workflow.

1
HLL_maxOP•

I use a grunge mask that I think is an engine default? As in, it's packaged with it.

1
FaulerZauber•

I don't find it but whatever I will get one somewhere else.

1