Can UVs not be rotated for normal maps in UE4?


I’m doing normal maps for UE4 for the first time and I just realised what one of the problems I’ve been having are because of.

I have four screws on my model which are all positioned on the same side, so they should all get the same light and reflection. And in Substance Painter, where I baked the normal map, they do. But when I import the normal map into UE4 the lighting on the screws looks like they’re being lit from completely different angles and I just realised that it’s because UE4 is interpreting the normal map as if all of the UVs are rotated the same way.

Here’s an image to illustrate it:


Is there a setting to fix this in UE4, is there a way to fix it in Substance Painter or will I have to redo the UV?


Try inverting the green channel of your normal map. Substance painter project settings need to be set to DirectX and not OpenGL in normal map settings.

Flipping the green channel just flips the light area to the opposite side. Like this:


I used DirectX in Substance Painter both in the project settings and in the export.

Are you not meant to be able to have your UVs rotated in different ways for normal maps? I understand that they can’t be flipped or reversed, but I hadn’t heard about there being issues with rotation.

This is UV0 right? You can’t do normal maps on UV1 without using the Material Function to Derive Tangent basis.

If its not that, could be settings with tangents or something. Try posting a larger image showing the shape of the mesh and how the unwrap is done. Your tiny images are really hard to read.

It’s not UV0, it’s UV2. I hadn’t heard about any of that from the tutorials I’ve been watching. I thought using a separate UV for normals was standard. The only thing I had heard of to change the UV set was the Texture Coordinates node.

How does the Derive Tangent Basis node work?

It creates a tangent basis by using DDX and DDY of the separate UV channels. These are called ‘partial derivatives’. It will not work for mobile platforms as a result.

The material must have “tangent space normal” unchecked and then you just use the output WorldSpaceNormal from the DeriveTangentBasis function and you are good to go. There may be some slight lighting seams since the derivatives have facets due to linear interpolation of the UVs. You’d just have to try it to see how bad they are. Generally, the more you rely on intense vertex smoothing the worse they will be. But the blue part of your normal map looks relatively flat so you should be ok.

Cool, thanks!

I’m getting an Error-message on the DeriveTangentBasis node. What am I missing?

Edit: Nevermind, I figured it out. It should be the other way around, shouldn’t it? :rolleyes:

Yes, the normal should go into the input Normal on the function. And the UVs to derive for must also be plugged in there to the UVs input on the function. The WorldSpaceNormal goes directly to the normal on the material input pin.

Do I need to change anything with the DeriveTangentBasis node or something? Because I get exactly the same result with this setup as before the Derive Tangent Basis node.

You did not hook up UV2 to the UV input on the function. So its just deriving for the wrong UVs.

Cheers! It works now. Thanks a lot for the help.

Some of the objects react a bit weirdly when I try to use the DeriveTangentBasis node.

One looks like this:


And the other almost completely turned black:

Why could that be?

That is pretty odd. I haven’t seen that personally but I would only suggest using this as a last resort if you really cannot use UV0. The black flecks look like 2x2 block artifacts which could be from using ddx and ddy.

It also uses the vertex normal to derive, if something is weird with your normals it could be causing it. But its impossible to say without seeing much more information about the mesh. Ie, UV layout, vertex normals, world orientation.

Would it be a more efficient workflow to put the normal on UV0, the lightmap on UV1 and the texture on UV2?

UV0 for normal maps is the way to go.

Yep, that solved every issue we had pretty much. Great to know! Thanks again!