SpriteAtlas removes channel information from normal maps

The SpriteAtlases I create seem to be discarding channels from normal maps that are marked as secondary textures.

No combination of settings that I’ve found have been able to preserve the normal map channels (which we need). I think this is a bug (so I filed a bug), but I figured I should also check with the community to see if anyone has a work around.

I tried rewriting the default ScriptablePacker to preserve Color32 instead of crushing data down to one byte. But that didn’t seem to make any difference.

Could you please share the bug report ID? Will take a look asap

Absolutely, and thanks for your reply!

@Venkify ← Adding this for the notification

Thanks for the repro project.

The SpriteAtlas does not miss any color channels. It’s the preview that can cause confusion.

Since the source format is set as NormalMap the preview in the Source Texture Inspector is displayed as Normal Map preview. However in SpriteAtlas all formats have a common RGBA preview. Hence the perceived difference.

You may be able to verify this if you use RenderDoc and check both the Atlas and non Atlased Normal Map Texture and they should be preview the same for RGBA data.

If this is not the case, could you please provide more info ? Thanks.

Thanks so much for looking at this, @Venkify!

So, we have been experimenting further and it seems that the problem occurs not when the Normal Map is added to the SpriteAtlas, but when the texture is designated as a NormalMap.

We found this other post that seems to suggest Unity is moving the red channel to alpha:

I don’t really understand that. But it seems this is not the fault of the SpriteAtlas, but something wrong with the NormalMap setting.

So this is either a bug, or a very strange feature that’s making it impossible to make textures as Normal Maps. Is there a way to amend the bug report so that it’s not about SpriteAtlas, but about Normal Maps / Texture Importer?

OK, our graphics dev said Unity is changing the order of the channels and that he’s able to account for it in his shaders. So, I guess this is not a bug, but just the way Unity deals with Normal Maps.

Honestly, it’s a bit above my pay grade so I don’t fully understand why things are the way they are, but I’m leaving this comment here in case anyone else runs into the same issue and also doesn’t understand why everything is red all of a sudden.

And thank you @Venkify for your time!