1
\$\begingroup\$

I'm making a 2D ball game in Unity v6.0, now in the process of adding some 2D lighting. The player ball is a circle sprite. To make it look like a sphere, the sprite has a normal map added as a secondary texture. The light effect works fine with a 2D spot light. (Using URP: sprite-lit-default as the shader.) However, when the ball is rotating, the light intensity changes with the rotation. I am assuming this is because the normal map's rotation follows the sprite's rotation.

Is there an easy way to fix the normal map rotation, so that it does not rotate when the 'parent' sprite rotates? (preferably without using custom shaders, for now..)

Here's the normal map I'm using: normal map circle

\$\endgroup\$
8
  • \$\begingroup\$ Can you show the normal map you're using? \$\endgroup\$ Commented Apr 29 at 13:38
  • \$\begingroup\$ Added the normal map PNG as an edit in the question. \$\endgroup\$ Commented Apr 29 at 16:00
  • \$\begingroup\$ Hmm, after some thought and further searching online, I'm starting to think it's not caused by the normal map rotating, but by rounding errors in the automatic rotation of the normal map.. (because the png map uses only 1 byte per channel?). This article here seems related: link. \$\endgroup\$ Commented Apr 30 at 7:11
  • 1
    \$\begingroup\$ Hmm... it might have been saved with gamma correction, biasing the values toward one side? \$\endgroup\$ Commented Apr 30 at 9:29
  • 1
    \$\begingroup\$ Not really, no. You're not rotating every texel in the map, you're rotating your input vectors when you sample it, and that work more or less has to be done anyway. It's a dirt cheap operation on a GPU, and not something you need to worry about when making a 2D game, even for mobile. \$\endgroup\$ Commented Apr 30 at 11:46

1 Answer 1

2
\$\begingroup\$

I have tested it with a different normal map: This normal map works well

Now the lighting works fine. The problem was with the normal map posted in the question.

\$\endgroup\$
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.