Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DarnVisages · Sep 05, 2017 at 03:08 PM · shadershadersanimationsnormalmapnormal map

Shader and normal map working when editing, but sprite turns black when running with animations

Hi all, so I have a strange issue that only starts happening with animated sprites and only when the game is running or built, NOT during editing. I have a character sprite with a shader and a normal map that appears to work fine in the scene view AND the game window while I'm editing. You can see the character and the trees working correctly in this screenshot, both using the same shader in separate materials with their corresponding normal map:

alt text Note: I pulled the trees randomly online to test with because the character wasn't working. In case you recognize them as someone else's trees.

I can move a point light all around the sprite during editing and light is mapping correctly, including every animation (during editing by playing each animation from the Animation window).

Once I run the game it becomes a 100% black silhouette, but only for the player: alt text

It seems to only be going black for an animated sprite and only if the animation changes, as it stops turning black when I disable the animation script, thereby allowing it to stay on the default animation. The animation script doesn't control anything directly, it only updates parameters like "Grounded" and "Speed" so the Animator can choose the transitions.

How do I make sure each animation continues to use the normal map? Or is that not the problem and there's something else I should be fixing?

The shader I'm using: http://6502b.com/article.aspx?id=67

Any insight would be greatly appreciated! Thanks in advance!

screen-shot-2017-09-05-at-82943-am.png (466.1 kB)
screen-shot-2017-09-05-at-82955-am.png (414.6 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DarnVisages · Sep 05, 2017 at 06:22 PM

I found the problem! I was setting my localScale on the object with a Vector2. Everything is working if I remove this line from my animation script:

 transform.localScale = new Vector2(thePlayer.lastDirectionPushed, transform.localScale.y);

And replace it with this:

 transform.localScale = new Vector3(thePlayer.lastDirectionPushed, transform.localScale.y, 1f);

I'm not sure why I would have had a Vector2 for my localScale in the first place, but all is well now!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by akillingbeck · Sep 05, 2017 at 03:39 PM

When entering playmode is your player gameobject set to a position which is infront of the light? Try fiddling with things in the inspector while this problem is showing, that can help a lot when debugging this stuff.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DarnVisages · Sep 05, 2017 at 03:52 PM 0
Share

Thanks for the response @akillingbeck !

No position changes are made. If I stop sending animator calls, like Animator.SetFloat() or Animator.SetBool(), the shader and normal map continues to work for the default animation in playmode. It seems to only go black once the animation changes.

avatar image akillingbeck DarnVisages · Sep 05, 2017 at 03:55 PM 0
Share

I assume you've created the normal maps for each animation?

avatar image DarnVisages akillingbeck · Sep 05, 2017 at 04:00 PM 0
Share

yeah, I have a full spritesheet with every frame for both the sprite itself and the normal map: alt text

screen-shot-2017-09-05-at-95821-am.png (42.3 kB)
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

normal maps on iOS with a custom shader.. Works, but not the way I need it to 0 Answers

Problem with Normal Maps 1 Answer

a shader or decal that only renders the normal map 0 Answers

Normal map mask 2 Answers

Mobile Bumped Diffuse problem 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges