The normal map displays correctly on all but the left and right faces of my cubic mesh.
This is a procedural mesh I’m generating at run time, I’ve double checked the normals are going left and right respectively, it’s built by the same function as the other faces, but it doesn’t show the normal map correctly. I’d expect to see the vertical lines of the normal map, but no rotation shows them.
This is using the standard shader with the normal map on a secondary map on uv1
Is there something wrong with my mesh? I’ve included a package that is just the mesh and normal texture.
Normal maps only works properly on UV0. If UV1 differs too much from UV0 then the normal maps will be done wrong.
The reason why is tangent space normal maps rely on the tangent data stored on the mesh. That tangent data is generated by Unity when importing the mesh. Tangents can be roughly described as a vector aligned to the orientation of the texture UVs. Specifically, UV0. Meshes in Unity only have tangents for UV0. So the Standard shader just uses those tangents from UV0 for the secondary normals, regardless of which UV set you’re using. This works “good enough” for the common case usage of secondary normals, which is to add some nondescript noise to a surface. In your case where your normals are more explicit, this doesn’t work out. You will have to use UV0 for this normal map, or you will need to use a custom shader that can handle this.