Alternative to distance fields?

Hello! I am trying to figure out a way to get a simple gradient along where my meshes intersect.

Basically I am trying to make a dynamic dirt mask, so that by merging my gradient and a dirt mask, I can get dirt in creases etc, without having to hand paint every single possible mesh placement combination.

I am aware of distance fields, but find them very inaccurate and prone to errors. Objects using distance fields also cannot make distance fields themselves, which pretty much ruins their use for me.

Using a depth node sort of kind of works, but not really, as it depends on there being an underlying mesh that’s placed well enough.
Do you have any suggestions on how to generate a map that’s brighter the closer to another surface it is?

Lightmass can bake a hidden AO mask that you can use in material graphs, it pretty much exists specifically for this purpose

https://docs.unrealengine.com/en-US/…computedaomask

https://docs.unrealengine.com/Images/Engine/Rendering/Materials/ExpressionReference/Constant/PrecompitedAOMas_00.webp

Thanks for the tip! That does indeed seem to be *exactly *what I am looking for. However, I cannot quite seem to figure out how to actually generate the map on my existing map. I managed to get something going on a new map, but it’s quite inaccurate and blurry, but I suppose I can adjust the settings.

My world uses dynamic lighting only, but I tried to temporarily bring in a static light so that I could build lighting and hopefully generate AO maps. But I appear to be stuck with the temporary “preview” lighting only and it will not build anything even if I build lighting.

In project settings under engine - rendering -> lighting do you have Allow Static Lighting disabled?

You’ll probably want to use a Skylight for the bake if it is an exterior scene, you can try setting it to stationary (so you don’t get light intensity/color baked into the map) for the bake then change it back to dynamic once the bake is finished

I tried to set my skylig to stationary and use that.
Static lighting is enabled, but for some reason the build process just completes after texture streaming is done and never builds lighting.
Build lighting only just immediately finishes.