[Shader] Rotate tileable normal map (texture coordinates)

Hello everyone,

I have set up a master material where one of the parameters is a float that rotates the texture coordinates 90 degrees counter-clock wise. However, this method doesn’t work with the normal map texture, and whenever I rotate the UVs, it outputs wrong the normal map.

GOOD SHADING (No UV rotation)

BAD SHADING (UVs rotated 90 degrees)

MATERIAL SET-UP

I would like to know what would be the best way to solve this, bearing in mind that being able to rotate the UVs within engine is a requirement.

Thank you everyone :slight_smile:

The rotateAboutAxis node will solve this.

free mat function using it as example:
https://forums.unrealengine.com/community/community-content-tools-and-tutorials/61131-material-function-world-aligned-texture-normal-with-offset-rotation

tutorial: WTF Is? Material - Rotate About Axis in Unreal Engine 4 - YouTube

Material setup using it to rotate the normals:

That did the trick, Thank you @Luos :)!

I would like to add that you need to set the speed of the rotator to 1, by default it is 0.25, and it didn’t work with that default value, it took me a while to figure that out!
By the way, in your free function you didn’t set up the normal map to compress as normal map, but as a default texture, did you do it for any reason? I have always wondered why when you compress the texture as a normal map, it will display as a darker blue in the material editor (like in my screenshot) as opposed to the typical 0.5,0.5,1 value (like in your screenshot)