How to convert Object Space normal map to Tangent Space.

I have a model with Object Space normal map texture.

Do you know how to convert normal map texture that is in Object Space into Tangent Space normal map texture.

I need to have it as a separate texture.

The “easiest” option would be to rebake the texture using something like Blender or Substance. Both should let you assign the original object space normal map and bake to a tangent space target.

They should but, I have tried to find some solutions for blender but could not. Also I have tried xNormal bake Object Space to Tangent Space tool but the resulting Normal Map looks nothing like our usual tangent space normal maps.

I got some suspicions why it gives wrong result using XNormal. It might be because of world coordinates. Coordinates in xNomral are probably different than in unity.
Still I was not able to find any info about this problem.

AFAIK in Blender if you assign a material with an object space normal map to an object, then bake out the tangent normals of that object, it’ll use the material’s normals.

I’ve personally never gotten xNormal’s world/object to tangent to work properly in any scenario, though I’ve only tried it once or twice. As a general purpose baking tool it’s fantastic, but it has a lot of tools that were written for some very specific use case with little documentation for what that original use case was. PRTpn maps for example, I have no idea what they are, apart from occasionally I see people who speak Russian ask about them. Otherwise I have absolutely no clue what they’re for.

Handplane3D is another tool that might do what you need, though it’s fairly old at this point. I know of a lot of people who have used it in the past to get normal maps from one form to another, though I suspect the output won’t be entirely perfect.
http://www.handplane3d.com/

An alternative is you can use Unity to do it, though you’d have to write custom stuff for it. But if you write a shader that uses the UVs as the clip space position, and then apply an world to tangent space transform to the normals, you can render those into a render texture and then save it out as a PNG.

So, for “fun” I wrote a tool to do this.

7717492--968053--upload_2021-12-7_12-58-14.png

By default the above output is wrong. This is a default settings xNormal object space normal map, and it’s really, really wrong for Unity. Here’s it fixed by changing the object space XYZ swizzle settings.

The “Save Tangent Space Normal Map” button saves a texture to the same location as the input Object Space texture appended with _TangentSpace. Be warned it’ll silently overwrite an existing texture.

7717492–968044–ObjectToTangentSpaceNormalTool.zip (5.36 KB)

8 Likes

I might need this for an eyeball normal map that I’m baking out

damn! good job! I’m gonna try that straight the way!

I was wondering is there an other way to actually set up one game object into a object space normal instead of tangent. the said object is not moving not stretching not rotating. and I hand paint an object space normal map for it, but when import in unity the object seems like bit receiving the light at all. I could paint a tangent space normal seamless texture and then put it into a material but it’s looking way less good than the actual object space one, plus, the goal of this is to actually break a bit the edge of the mesh by the normal map, the tangent normal space keep every edges neat.

Have you ever found a workaround for this? Been trying to find a solution to get object space normals to work forever, but it always breaks my lighting