Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 39487
In Process

askthedev.com Latest Questions

Asked: May 5, 20252025-05-05T06:14:33+05:30 2025-05-05T06:14:33+05:30

How can I prevent a normal map from rotating with its parent sprite in Unity’s 2D lighting system?

anonymous user

I’m working on this 2D ball game in Unity (using version 6.0) and trying to add some visual flair with 2D lighting. The main character is a circular ball sprite, and I’ve added a normal map to give it that nice sphere-like appearance. I’ve got everything set up, including a working 2D spot light, and the lighting effect looks awesome. I’m using the ‘sprite-lit-default’ shader from URP, which works fine for the most part.

Here’s where things get tricky: when my player ball rotates, the normal map also rotates, causing the lighting to shift and change its intensity in ways that look weird and not at all what I intended. I assume this happens because the normal map is set to follow the parent sprite’s rotation. It’s super distracting during gameplay, and I really want it to appear as though the normal map remains fixed while the ball itself rotates.

Is there any straightforward way to fix this issue without diving into custom shaders? I’d love to avoid that for now because I’m not too familiar with shader programming, and I’m worried that it might add more complexity to my project than I can handle at this stage.

I’ve done some searching online and found mixed information. Some solutions look promising, but also a bit intimidating for someone who’s still getting their feet wet in Unity development. Honestly, I just want to keep things simple and clean but also ensure that the lighting effect looks polished.

If anyone has suggestions on how to either set the normal map to not rotate with the sprite or work around this issue using existing tools in Unity, I’d really appreciate it! Also, here’s the normal map I’m using if that helps you understand the visual aspect better: [normal map circle](https://i.sstatic.net/izAmxOj8.png).

Thanks in advance for any insights you can provide!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2025-05-05T06:14:36+05:30Added an answer on May 5, 2025 at 6:14 am

      This issue happens because the normal map rotates alongside your sprite, causing the lighting changes you’re observing. To fix this without custom shaders, a straightforward workaround is to separate your visual representation from the functional rotation of the game object. For example, you can create an empty parent GameObject that handles rotation and movement logic, while your sprite renderer, with the normal map applied, remains on a child GameObject that does not rotate. This way, the normal map stays fixed relative to your lighting setup, eliminating unwanted visual shifts.

      Alternatively, Unity’s built-in components provide another simple approach: ensure your Sprite Renderer component uses the “Draw Mode” setting set to “Simple” to prevent automatic rotation of texture UVs, or check the Transform component hierarchy carefully to ensure rotation occurs elsewhere. Often, keeping the visual sprite in a child object with zero rotation can solve such issues effectively. Both methods allow you to achieve stable and visually appealing lighting results using Unity’s existing tools without diving into complicated shader programming.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2025-05-05T06:14:35+05:30Added an answer on May 5, 2025 at 6:14 am

      Stabilizing Normal Map Rotation in Unity

      It seems like you’re facing a common issue when using normal maps in 2D Unity games, especially when rotating sprites. The default behavior indeed makes the normal map rotate along with the sprite, which can mess with the lighting effects you’re trying to achieve.

      One simple way to handle this without diving into custom shaders is to create a separate GameObject for the normal map. Here’s how you can do it:

      1. Create an empty GameObject as a child of your ball sprite. Name it something like NormalMapHolder.
      2. Add a SpriteRenderer component to this new GameObject.
      3. Assign your normal map texture to the SpriteRenderer.
      4. Set the NormalMapHolder to not inherit the rotation of the ball sprite by modifying its Transform component (you can set rotation values to 0).
      5. Position the NormalMapHolder exactly over the ball sprite.
      6. Make sure to set the Sorting Layer and Order in Layer on the NormalMapHolder so it renders correctly in relation to the main ball sprite.

      This way, when your ball rotates, the normal map will stay fixed in place, and the lighting effects will appear as you intended!

      If you want to keep things super simple, just remember that Unity often has some built-in solutions for common problems. This workaround should help make the game look polished without getting into the complexities of custom shaders!

      If you have more questions or run into any issues, the community is very supportive and can often provide additional insights!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Sidebar

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.