Normal Map Blending in Unreal Engine 4


Blending normal maps can come in very handy in Unreal for layering tileable textures and getting an extra bit of detail without having to spend resources on larger textures.  After seeing the "Add" node being used in a few user level files, I decided to do some comparisons.  The results I found are similar to some of the mistakes made by simply overlaying normal maps in Photoshop instead of the proper method of multiplying the blue channel while only overlaying the red and green channels, or using programs like nDo or Combiner.  Those work for the purpose of adding one detail normal two another, but in terms of creating a live, scale-able normal blend in Unreal, a loss-less method for adding is needed (unless, of course, muting the detail of either normal map is the desired effect).


Unreal Engine 4 offers a BlendAngleCorrectNormal function, but it is a bit cumbersome for the blending of two normal maps already oriented correctly (green and red channels for each have corresponding directions).  I created a simple function that acts like the "Whiteout blend" described here.  Works well at maintaining all of the detail, rather than washing it out, and packaging it in a material function keeps things tidy.  BC5 compression ditches the blue and alpha channels of the map, the blue being re-created in the texture sample node, and changes the color depth (from 0 --> 1, to -1 --> 1).  For these examples I generated two normal maps from nDo and rendered screengrabs from Unreal 4, version 4.5.1:

Keep in mind, blending normal maps is never 100% correct, but is needed often.  It is best practice to bake a map correctly versus adding additional details after the fact.