normalMap on android

Hey,
how does normalmaps work on android?
If I set my texture with normalmap flag it shows wrong ( left image ), it I set it to texture it looks right ( right image ), but still shows wrong on the model. I tried with my own shaders and also unity’s basic shaders like mobile/bumped specular but it looks completely broken. works fine in PC/Mac mode but gets broken as soon as I switch to android.

Any help with that?
Thanks

Cannot confirm, have worked with normal-maps and Android for months just fine. I’m seeing another difference in the above shots, left one is compressed, right one isn’t. Have you tried a number of other normal maps? Maybe this map is a one-off “weird case”…

Yes it does that on every normal maps, also tried different compressions settings to see if this was the problem, but it doesn’t look like it.

Humm… I think it happened to me once… is it PNG?? Try jpg… se if it works…

How are you unpacking the normal map?

For non-mobile platforms, Unity compresses it swizzled. For mobile platforms, it doesn’t do that (because it’s more costly to unpack).

The Unity function UnpackNormals from UnityCG.cginc will handle the normal map unpacking correctly depending on what platform you’re building to.

The files are in .tga format.
I use the UnpackNormals function in my shader. I also tried the defaults unity shaders and does not work either. I’m wondering if it has something to do with my android SDK? does unity use it for texture compression or something?

thanks

Ok. I can confirm this. Works fine in Desktop, is broken on mobile (Android/iOS/Blackberry).
I’m using a default bumped diffuse shader. Tried all the options for texture importer. As soon as you convert it to Normal map, it gets this “pink” color instead of being blueish.
The only workaround I found is to edit the normal map in photoshop, swap channels so the original Red channel ends up in the Alpha channel, and save it as TGA for example.
I’m pretty sure that’s not the expected behavior, as it didn’t work like that before. Also, this channel swapping is something that Unity needs to do internally, and not something we need to take care of.

I’m glad that I’m not the only one with this issue, however we’re making a multiplatform game I cannot have 2 sets of normal maps for every model… Is there a better way to submit a bug other than from the menu in unity? because I never got any response from committing a bug from there…

I don’t think so. I’ll submit this bug again, and see if I get any response.

Most likely this is a known editor bug that we’re working on already.

The corrupt-looking normal maps should work ok on the actual mobile devices. The editor just displays them incorrectly on DX11 mode.
As a workaround, try disabling DX11 from the PC player settings → “Use Direct3D 11”

However, do let us know if this doesn’t help or if there are faulty results also on the actual HW.

Yeah, that fixed it!
I’m glad you’re aware of this issue and that it’s being fixed.
I think it would be a good idea to post the known bugs somewhere and also post the workarounds you know of.
If not on the forums, then at least update the issue tracker to state that you’re working on a fix, and that there is a temporary workaround. Might save someone else a few hours figuring out what the hell is going on and submitting a bug that UT still has to analyze.
Thanks!

Yep, PC settings, switch off that DX11 and its good for the build on your mobile device. :slight_smile:

Thanks!