Recently I’ve been having a fiddle with terrain blending in ue4 using distance fields. Tech art is an interest and hobby of mine and I love digging in and getting my hands dirty in that side of development every now and then. I love the pretties.
Here’s a quick comparison:
I was inspired to put together this material setup after playing yet another DICE/Frostbite game with impeccable terrain blended rock faces and wanted to see if I could get anywhere near as nice a result with ue4.
Here’s a different comparison showing a blend where cliffs dither into a slope based terrain material, super useful when adding rocky overhangs. Textures and meshes are just placeholders that I’ve been building the material with but I’m quite happy with how well the material works. (grey material on the terrain in the second image so you can see what’s terrain and what’s a mesh).
This is the first of probably 2 post&video combos as the ultimate goal is to modify unreal engine source so I can access the terrain height and splat textures at run time (something that isn’t currently possible). The material setup detailed in this first video is therefore using distance fields to drive blending.
A third method I may investigate is a nifty blueprint construction script that can essentially vertex paint a mesh we want to blend with terrain on placement (line trace from some verts to the terrain to get material info and height?). The benefit of a constructor based approach is that it wouldn’t require modification of engine source OR the use of distance fields to handle the blend.
Using distance fields to blend in this manner has plenty of caveats which I discuss in the video, but one I forgot to mention is that half of this technique (pixel depth offset dithering) only works correctly with TAA enabled. So definitely keep that in mind if you’re thinking of using it in a project. You can still blend the material layers but wouldn’t get the benefit of the super soft edges that the PDO method give you.
So yeah if you’re interested in the full breakdown of the distance field method here’s the video I put together. Check the description for helpful timestamps if you’re looking for a section in particular.