Distance Field broken with Landscapes

So I followed @RyanB and @DanielW advice in their posts here.…153#post491153

I created a material with the DistanceToNearestSurface divided by 1000 and plugged into the Emissive channel. I set this material to both a landscape and a Floor static mesh (with Affect Distance Field Lighting turned off) to test. Finally I added two box static meshes to the scene and here is the result.

As you can see, the distance field works fine on the Floor static mesh on the right, but is broken on the landscape on the left.

You can see here that the mesh distance field looks correct.

However, if I look at the global distance field, what is this?

The landscape is a big blob in there, so I have a feeling the material is picking up on some distance field information from the landscape itself from this global distance field. Is this intentional or a bug?

I couldn’t find an Affect Distance Field Lighting option to turn off for the landscape, so is there some way to stop it adding to the global distance field?

What version of the engine are you on? In older versions (can’t remember exactly when) we didn’t used to put landscape in the global distance field, which is what DistanceToNearestSurface looks up. Nowadays we do, and there’s a cvar to control it: r.AOGlobalDistanceFieldRepresentHeightfields (set to 1 by default).

@DanielW - I’m using the latest 4.18. Is there any side effect to turning this off for the landscape? I mean why is the landscape in the global distance field and what do I lose by turning off?

On a side note; I know you can put console variables in the Engine/Config/ConsoleVariables.ini, but then that affects every project. So I put it in the Config/DefaultEngine.ini file of my project and that seemed to work. Is that the correct place to put them on a per project basis?

You loose AO from landscape onto meshes in the scene from DFAO, if you have that enabled.

IIRC putting them in DefaultEngine.ini requires being in a [SystemSettings] category, so the engine will actually parse those as cvars. Otherwise you need to use your project’s DefaultScalability.ini.

I am going to add a bAffectDistanceFieldLighting to landscape so you can control this like you would on any static mesh, instead of using a global cvar.

Yes please. I actually looked for that option on the landscape before posting on the forum as I saw the static mesh had it.

Any ETA on this please?

sorry for unearthing this thread. but i just have to say “THANK YOU” this cvar saved my life. we still use 4.19 so this was great knowledge

I have this problem in 4.23, in the visualizer, i can see only 2 mesh i added to the character pb, i don’t see it on landscape, or on character mesh