Landscape Material Ambient Occlusion Maps

I have spent a good deal of time learning about Ambient Occlusion maps, and I am currently working on a landscape material which is new to me. I realize on things like characters and objects, using an ambient occlusion map fo materials can greatly increase quality of rendering. However, I am unable to find any info concerning using ambient occlusion maps for materials used on landscape terrain. I am trying to see what if anything I am sacrificing by removing ambient occlusion maps from my landscape materials. I am trying to get 8 layers on a landscape, which gives me 2 textures to use per layer to maintain 16 texture samples. I a mpacking my textures as follows:

ANx = Albedo (RGB) and Normal X (A)
HRMNy = Heightmap (R), Roughness (G), Metal (B), Normal Y (A)

I use DeriveNormalZ to get the Normal Z at runtime to reduce texture sampling a normal texture by itself.

This leaves me with no room for packing Ambient Occlusion map. I have tried testing, but I have never really been able to figure out how to properly use Ambient Occlusion to really be able to test properly. Was hoping someone could give me some insight so I do not run into a problem a ways down the road in development?

I could bake the AO into the Albedo for a Diffuse, but in trying to do so, it would seem trying to export Diffuse in Quixel Mixer gives me the same result as Albedo, which I was thining choosng Diffuse would bake the AO in for me so I would not have to do it manually via another Graphics software such as Photoshop.

The only issue I have is with a material that has metal, if a material is non-metallic, I replace the Metal channel with AO for a HRAONy Texture.

I have one directional light, which could be either dynamic or static - it does not need to be dynamic.

So, on landscape materials, would removing AO be noticable? Would AO give betterrenders than using World offset and tesselation? My assumption is World Offset with Tesselation would be better to keep?

Thanks for ay insight!

What are the terrain types that has any kind of metal?

Any metal, gold, silver etc. To show areas on map which have resource deposits, metal ore deposits. A workaround would be to use decals I suppose, but trying to make it material based. Also wondering just for the sakw of gaining extra knkwledge.

We actual use landscape grass system to spawn small rocks, pebbles, flowers, leaves, roots. I would use this system also for gold/iron ore.
But for the layer problem. Have you tried to use new landscape virtual texturing?

Yes! I recently discovwred the grass system. I plan on looking into that to spawn both Resources and terrain detail objects like boulders, trees, bushes etc. I have to look into specifics, like does it spawn actors, meshes only etc. Looking into how I can use actors with instanced meshes for resources, and targeting specific instanced meshes in resource actor for mayerial affects and removing a boulder when reclaimed. Anyways, on the layer material, a metal mask may be required to show say a rocky terrain with streaks, flakes etc. of metal. Also, to plan ahead for unknowns I just wanted to maybe prepare a master material with several switches for varying options. And if material AO is not noticeable or not rendered from a material texture I didnt want to waste a slot that I could use for an emissive mask or metal mask. I have honestly had a hard time getting a solid comprehension of how AO works and implemented as thwre seems to be few different ways. Appreciate your input, thank you!

Ambient occlusion is quite simple. Its just occlusion factor for non direct lighting. It is very noticeable.

I understand what it is, but when it comes to actually implementing it their seems to me to be several factors, as their are different setting options, and you have screen space AO and Distance Field AO, and coveats to both. So, not quite so simple. I have seen photos showing characters and object before and after AO, but canno find anythiing regarding Landscape materials or before and after photos, and differences in having movable sky light and directional light and static sky light and directional light. I have so far, been able to pack as such:
Texture 1 - Albedo, NormalX (RGBA)
Texture 2 - Displacemnt, Roughness, AO, NormalY (RGBA)

Doing this and using the the Sample Source setting on my texture sampler nodes of “Shared Wrap” I was able to get 8 Layers. I do not notice any Ambient Occlusion however. And in researching, all I have been able to find is a one sentence comment someone posted on a post that mentioned something about most devs not using Ambient Occlusion on landscape materials. I do not notice any ambient occlusion, so dont know (because I am new to this) if I am missing something in my setup or if Ambient Occlusion is just not noticeable on Landscapes.

This may be a moot point however, as I have disabled displacement and tesseleation for all my layers and with a landscape 8161 x 8161, 255x255 Quads, 2x2 sections and 16 components I have noticed a considerable bog down in performance. My textures are all 1024x1024. I don’t know if their is further optimization for me to increase performance other than reducing texture size (will try 512 and 256), so perhaps I may not be able to use 8 textures. Which would be unfortunate, as I have made maps before and going from 4 to 8 textures made a significant difference in the look of the map (Supreme Commander). A large area, if not the entire landscape, could and most likely will be visible at once. I used initially a single 8k texture using real-world aerial photos of the landscape, which looked ok, but did not give good fidelity close up.

I know supreme commander only uses albedo and normals for the textures, so don’t know if adding roughness and AO maps to mix is also contributing to performance hits, as well as calculating the Normal Z instead of reading from texture.

Hi, AFAIK ambient occlusion from the material input only works with dynamic lightning if you disable static lightning in the project settings. Else you would need to bake the lighting, then the AO from the material will be baked into the lightmaps.

As for performance, the more (especially complex) layers you use, the worse it is for performance. You could take a look into runtime virtual textures that might give you back some performance there.

Hey, thanks for this info, this is the kind of information I was needing and looking for to look into :slight_smile: I will check these settings and see what I come up with. Thank you.

My 2 cent is, ignore almost everything and use minimum texturing.

Take a page from Kite demo. Have a through look at their landscape material.

They do not use anything more then an albedo and a normal.
and out of the abledo they play with the R channel to do some effects.

this is because a complex terrain material can eat up to 90% performance or more.

If you want super high details and performance, forget the landscape. Work in an 3d editor, make meshes.
You can also do this by converting individual landscape tiles later on, once you have it finalized in engine.

with landscape, anywhere above 5 layers you start to get performance degradation.
which is how rtv solves performance really. It creates 2 texture out of everything, and uses that instead of the standard material making the look identical to what you painted but different (lower res).

BTW, generally speaking most open world (or lets call them “ouside”) games (rdr2, kcd, Witcher3, etc) have rather low resolution for terrain textures.
thats because using 2k textures vs 1k texture comes at a high render cost.
refer to this for some optimizations - mind you its very dated by now.

2 Likes

Oh, this is some good stuff here, will have to look at this intel optimization page in detail. I tried looking at Kite Demo before, but couldnt figure out how to load anything to look at lol, but that was when I literally first started with Unreal, so guess I need to try and look at that again. My thinking was surely after 13 years, things have progressed enough beyond where Supreme Commander was back then that realistic landscapes/maps could be done and higher unit counts etc. I will say, I have learned a tremendous amount in the short time I have spent looking into this and playing around with creating a quick protype just to see what could be done.

It’s interesting to here that using meshes would increase performance. I guess I just figured using a heightmap and landscapes would be much more efficient than meshes. Especially for a game that would have a huge map (I am currently working on a 20km that is shrunk down to 0.4% with 8161 resolution, and I would scale props and units etc accordingly, so that I could have potentially an 80km map with the same detail, using multiple landscapes. I will be curious to try meshes and see how performance is affected. Thank you so much for these insights and info!

No worries.
kite demo isn’t the easiest to break down. Just started or otherwise.
the landscape material is broken up into several functions. You’ll have to dig down to get to them…

The real reason that landscpe kills performance is component size to LOD0 ratio.

You can attempt to balance the labdscape LOD distribution but the new system (past .19) works about as well as pc cleaning software.
To boot, you also always have the built in tessellation and mip “feature” enabled without the option to block it. So you are basically always paying the cost for tessellation, regardless of whether it is in use or not.

There are many other reasons why static meshes outperform the landscape, but that’s the core of it.

Also, if you have a 1:1 world map like I do, and are dealing with 11k tiles, things get really more complicated then they should be with impostors and all.
in fact, it becomes easier to use 8km tiles to just reduce overall drawcall count rather than starting to try to somehow merge actors/levels arbitrarily.

What is heightmap used for ?

With your packing scheme above, you are depriving yourself from composite texture and proper mip map generation for your normal maps.
So, unless you are handling it on your art pipeline, your packing scheme is inferior to all other possible alternatives in each and every respect, unfortunately.

Depends. AO maps are primary candidate to get munched out for landscape.
It is not uncommon to bake a little bit of sharp cavity in albedo and call it a day instead.

@Deathrey probably for height blend.
I would throw that out the door too for performance sake. However things CAN look better with it on.

Out of curiosity, why would splitting and assembling normal map channels be worse than using a reg. normal map?
Wouldn’t both textures still mip according to whatever their compression settings are?
In other words, is it from deriving Z, or from the compression avaliable on normal maps?

Imho you gain nothing from an AO map on landscape.
on top of all things, it makes it harder to match grass color to the landscape color to make it appear natural and not like someone went in and planted sticks into the landscape :stuck_out_tongue:

@Deathrey The heightmaap is for World Displacment, an also for heightblend if desired. This is all great info everyone, thank you, exactly what I was trying to figure out. Although a little disappointing, I would like t osee landscapes for efficient and effective, but maybe it’s not so much the engine as it is the nature of the beast?

What do you mean I am depriving myself from composite texture? I was even thinking of reducing normal to a single channel linear and derive normal from heightmap node to build normals. But that seems silly now that I really the hit on performance including all the channels masks. Maybe I will pack Roughness in Alpha of Albedo and second Texture Normals. I would like to use Tesselation and Displacement, but seems like would be too expensive with 8 layers/materials (maybe 3 of 8 using displacement).

Baking cavity sounds like a good idea. You all have given me several things to try. Great stuff here.

One question - If I convert to meshes, I will need to calculate collisions on entire map, so if I make LODs for the meshes, will collision use LOD0 automatically for collisions?

[USER=“3140864”]MostHost LA[/USER] What do you mean Component Size to LOD0 Ratio? I would love to create a map that is say 130km (with a resolution of 2.5 meters per grid, and scaled down in size to fit in smaller area to reduce float precision errors). I am curious, are you using level streaming? From what I know, this is not an option for what I trying to accomplish. I want to be able to zoom out to see the whole map and free move/rotate camera. Its for an RTS game, but the units would all be vehicles, and the smallest would be say the size of a jeep, but the units get pretty big, around 50m+ high. I am trying to make something like supreme commander, but would like 2 versions, one being futuristic and one being modern day, like command and conquer. To be honest, this is waaaay beyond my level, I have only been using UE4 for about a year and a half, but trying to tackle this is teaching me soooo much!

Thank you everyone for amazing input! Much appreciated.

Exactly that. On large 8km landscapes the size of LOD0 is huge creating far too many triangles on screen compared to what it should. / because components are what make up the large landscape at 8k you have the largest possible components.

yes, world composition.

not true. World comp can work just fine because of impostors.

in a game like command and conquer or any rts i would stick to RTVT and landscapes up to a point.
if you get the data from real world locations, and turn it into levels you can dispose of the actual levels and just use the baked static meshes after the world is set and created.

You can mostly fake collision or use an lod with complex as simple if you really really need it, i think you have to worry more about localizing the nav mesh appropriately than anything else. And yes that does require some collision to work.
you could even export the level impostor mesh. Generate simple collision for it. Or generate simple collision for it directly within the engine.
Do a small test on one tile, see how it goes/what works best.

You have a normal map. It contains unit length vector.
You discard blue channel and reconstruct it in pixel shader, relying on knowing that it actually was a unit length vector, and blue channel was always positive.
So far so good.

Now, you are sampling normal map at mip level 1.
One mip level 1 texel contains averaged values from 4 level 0 texels.

After averaging them out, one of your core assumptions of it being a unit length vector is no longer applicable.
For that to be still more or less valid, you need to re-normalize normal at every step of mip generation, which is exactly what is done when you are using normal map compression and which will not be there for you when you use compression method other than normal map.

https://docs.unrealengine.com/en-US/…ite/index.html

This is some great info here. This topic has gotten a bit-off Ambient Occlusion, but has become full of some great info.
What is RTVT?
I was under the impression World Comp is not usable for Multiplayer? But, Fortnite uses World Comp yes/no? I did a quick look and it seems you have to turn off world origin shifting, which in other research I have found that beyond 1km distance, devs have gotten floating point errors, so not having world origin shift might be an issue. There is so much involved in creating a large map lol, especially for someone just starting out haha. In a nother post topic, someone mentioned converting landscape to meshes would give better performance. Also, I would not be running a dedicated server, so would not be abl to have a server load the entire world comp.

Thanks so much for this info, gives me a lot to look into and learn about!

Oh man, this is a great detailed explanation, Thank you! I think I actually turned Mipmaps off, ad if I remember correctly it gave me better performance, although I do believe I am gaining performance and sacrificing VRAM usage, but I would prefer the performance as I dont think VRAM usage will be an issue.

I checked out composite textures, thanks you! I never knew this existed! I don’t think the page really explains it all that great, but I will look on youtube for some better understanding an examples. Although, looking at their sample images, I don’t like the results.

Rtvt is real time virtual texturing.
the landscape system.

other than that, yes, fortnite uses world comp, and layers.
also the new atmosphere system I believe. When you skydive off the bus you can clearly see the double horizon line. Of where the map ends.
Which is really due to the fact the atmosphere doesn’t continue all-around without a custom sphere, like it did before.

Float point errors may (my speculation) depend more on final release platform. A pc will be able to handle up to 12km or so in my experience.
mobiles may have a harder time keeping up.
Either way, the effect is evident. Meshes and in editor gizmos become distorted.