Sprite Renderer Normal World Space flip between World Euler Angle Y 90 and 270 degrees

Hi,

I am having an problem I havent been able to resolve. I am using 2022.3.29 URP (edit: this issue also occurs on 6000.0.4 URP)

When I use a sprite renderer using a 3D lit shader, whether its a custom shader or Universal Renderer Pipeline/Lit, its normal world space flips when the renderers world euler angle Y goes between 90 and 270 inclusive. Normal Tangent Space does not have this problem and this problem does not occur with a mesh renderer. e.g. here is the sprite and mesh renderer at under 90 degrees

and here they are at over 90 degrees, the sprite renderer normal world space is flipped while mesh renderer is not. e.g. the sprite renderer looks like an indent instead of an outdent:

To add, the Normal Tangent Space does not flip and is normal for both (over 90 degrees).

No amount of flipping sprites, normals or rotations in shader or a billboard script seems to help or just causes other problems, like world lighting not working.

I believe the issue is in how sprite renderer renders the material.

Any help would be appreciated.

Tying to make 2,5D boomer shooter - and got the same issue.
2022.3.58f URP
NormalFlip

Hi, Your monster is looking good, I had been doing a similar game for a little while but moved on to other projects.

Anyway I did bandaid fix it.

For whatever reason Unity Products:Amplify Shader Editor/Vertex Tangent Sign - Amplify Creations Wiki (not sure of shader graph equivalent) was flipped so I had to create some nodes determine if the world euler angle Y is flipped based on the Vertex Tangent Sign between 90-270 (don’t recall which numbers are inclusive or exclusive) degrees. I don’t exactly recall how I did it.

I also don’t recall exactly what I changed when I determined the bit was flipped. Might have flipped the Z axis on the vertex normals or fragment normals.

1 Like

Thank you for the hint.
I was able to overcome this issue by getting the angle of the sprite and flipping the G (after splitting it to RGBA) of the normal map, based on the angle.

For the guys who’s struggling with the same situation:
I took the angle recognition here: Shadergraph: How do I get an object's rotation value inside of shadergraph? (HDRP)
Here is the custom shadergraph node for debugging - it’s able to print whatever float value you want: "Print a value" custom function node code for Unity ShaderGraph · GitHub
Here’s how it looks in my shadergraph