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.
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.