Question by
codytcheng · May 04, 2020 at 09:56 AM ·
2dlightingtexture2dscriptingbasicsnormalmap
2d normal map inverts highlight/shadow workaround help
New to unity! when I add 2d normal maps to my main player animations and then flip the scale to walk left, the map inverts all of the shadows and highlights. Is there a simple way to fix this? The only Idea I have came up with is to make a second normal map with the channels inverted to reference while my player if flipped. But where I am stuck is how would I make the change to the inverted map in the importer in my script?
example.png
(146.6 kB)
example-2-1.png
(35.1 kB)
Comment
Answer by kyuskoj · Oct 12, 2021 at 07:10 PM
I just changed the 'sprite-lit-default' shader.
...
Varyings NormalsRenderingVertex(Attributes attributes)
...
o.bitangentWS = cross(o.normalWS, o.tangentWS) * attributes.tangent.w;
=>
o.bitangentWS = half3(0, 1, 0);
...