Search code examples
unreal-engine4procedural-generationnormals

Strange shading behaviour with normal maps in UE4


I've been having some very strange lighting behaviour in Unreal 4. In short, here's what I mean:

enter image description here

Fig 1, First, without any normal mapping on the bricks.

enter image description here

Fig 2, Now with a normal map applied, generated based on the same black-and-white brick texture.

enter image description here

Fig 3, The base pixel normals of the objects in question.

enter image description here

Fig 4, The generated normals which get applied.

enter image description here

Fig 5, The material node setup which produces the issue, as shown in Fig 2

As you can see, the issue occurs when using the generated HeightToNormalSmooth node. As shown, this is not an issue relating to object normals (see Fig 3) or to a badly exported normal map (as there isn't one in the traditional sense), nor is it an issue with the HeightToNormalSmooth node itself (Fig 4 shows that it generates the correct bump normals).

To be clear, the issue here is the fact that using a normal texture at all (this issue occurs across all my materials) causes the positive Y facing faces of an object to turn completely black (or it seems, to become purely reflections-based, as increasing roughness on the material causes the black faces to become less 'shiny' looking).

This is really strange, I've tested with multiple different skylight setups, sun directions, and yet this always happens (even when lit directly), but only on +Y aligned faces.

If anyone can offer insight that would be greatly appreciated.


Solution

  • So I've discovered why this was an issue. Turns out there's a little option in the material settings called 'Tangent Space Normal'. This is on by default ('for convenience'), disabling this appears to completely fix the issue with the generated normal maps produced by HeightToNormalSmooth.