Unity HLSL : Normal Map orientation issue
Budget: $10 – $30 USD
I translated a HLSL code to work with URP shader graph, but I have an issue with the normal map, the dark part of the object with using the shader is not always opposite to the light, and if I rotate the object, darkness is supposed to stay at the opposite of the light but instead it rotate in another direction.
This is the stripped code:
void NoRepeat_float(UnityTexture2D tex, UnityTexture2D norm, float2 uv, out float3 Out, out float3 OutN)
{
Out = tex2D(tex, uv);
OutN = UnpackNormal(tex2D(norm, uv));
}
Then the outputs are connected to diffuse and normal of the shader graph output, the color is ok, but the normal orientation is wrong.
I just need that code to be corrected, it's a very quick job !
This is the stripped code:
void NoRepeat_float(UnityTexture2D tex, UnityTexture2D norm, float2 uv, out float3 Out, out float3 OutN)
{
Out = tex2D(tex, uv);
OutN = UnpackNormal(tex2D(norm, uv));
}
Then the outputs are connected to diffuse and normal of the shader graph output, the color is ok, but the normal orientation is wrong.
I just need that code to be corrected, it's a very quick job !