Hello guys.
Look, im using this shader to rotate a simple texture with a normal map.
Everything is working just fine.
The only problem is: the response of light is not following the rotation of the normal map.
The light behaviour only responds if the Object is rotated, but not the texture.
How can i make this work? How can i make the light and shadow inside surface Shader texture behave according to the its rotation (the texture rotation)?
Thanks.
Because normal maps are based off of the model’s tangents, which are calculated from the original UVs. If you rotate the UVs after the fact, the normal map no longer lines up to the model’s tangents.
You need to apply the same rotation math to the unpacked normal map’s .xy, just with the opposing rotation, to get this to work.
Yes, because _Time by itself is wrong and should never be used. The _Time variable is a float4.
The way you’re using it is being interpreted as “_RotationSpeed * _Time.x”, but some shader compilers (like for mobile) will just give you an error if you try to compile that without specifying a component.
Amazing job! Just saved me a lot of trouble, thanks!
I simplified it a little to be controlled by a fixed angle, i’ll leave the code here in case anyone needs it.