xNormal Map Format

I was reading through the built-in shader code for 5 the other day and I noticed an interesting comment:

// Orthnormalize Tangent Space basis per-pixel
// Necessary to support high-quality normal-maps. Compatible with Maya and Marmoset.
// However xNormal expects oldschool non-orthnormalized basis - essentially preventing good looking normal-maps :(
// Due to the fact that xNormal is probably _the most used tool to bake out normal-maps today_ we have to stick to old ways for now.
//
// Disabled by default, until xNormal has an option to bake proper normal-maps.

Is there another way to change this setting besides modifying the UnitytStandardConfig.cginc? It would be nice to be able to set this per map.

There are a LOT of different ways to handle tangent space, some better then others.
Unity’s built in way of generating tangents (by default enabled when importing a model…) is made for the way it reads the normal maps.
What you have to remember is that it’s likely a subtle if at all noticeable change in quality.

1 Like

That’s true. I have noticed a difference in appearance depending on where I get my normal map from(xNormal vs nDo is the most noticeable so far) though.

The comment struck me as odd and that there could be some finer control over normals.

Well, they “could” implement every known tangent space basis…
Lets just say there is no good reason to do so. What they probably should do however is give us an easy option to use mikktspace (a tangent space basis optimized for game usage).

1 Like

I thought that was the current default from xNormal already?

Wait, nevermind. I see it now, derivative map. Yeah, that would be nice.

As for setting this per map, well, it’s not the MAP that’s the real issue here, its the MAP + MODEL combination, and any model with imported tangents unity can’t know the tangent space basis for, so the combinations needed in the shaders… Well explode quite fast.

Wishful thinking I guess. Thanks!