Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Mephilin · Apr 13, 2017 at 03:13 PM · spritesshadows

Sprite plane doesn't cast shadow on another sprite plane

I'm trying to get small shadow under 1 of overlapping sprites. Basically I need to simulate shadow cast by 1 sheet of paper placed slightly above another (yeah, like Google's material design). Simply baking shadow doesn't sound good because the object above is rotating.

Scene setup is simple: 2 sprites + directional light source

Here's what I did:
1. Placed 1 sprite above the other along Z axis in 3D-view (same sorting layer, 0 and 1 position in layer)
2. Made light direction perpendicular to sprite planes
3. Enabled shadows in light source
4. Enabled shadow cast/receive in renderer settings
5. Used sprite/diffuse shader, also tried custom shader from here: https://github.com/anlev/Unity-2D-Sprite-cast-and-receive-shadows

Sprites do respond to light's direction/tint changes, but still no shadows from 1 plane on another. What am I missing?

P.S. I'm complete newbie to lighting, so consider ANY most stupid mistake you can think of.

Comment
Add comment · Show 1
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 RibsNGibs · Apr 14, 2017 at 01:25 PM 0
Share

Have you tested to see if they cast or receive shadows on/from other things? Add a sphere and put it behind and in front of your sprites and make sure. If so, it could possible be shadow bias if your sprites are very close to each other - try separating them slightly and see what happens.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by FortisVenaliter · Apr 13, 2017 at 03:41 PM

Not sure on the source of the issue... But if the sprites don't have any transparency, what you can do is give them sub-objects of planes with the default material and set the renderers for those sub-planes to Cast Shadows Only mode so they only cast shadows and don't render. That, in addition to your sprite renderers, should get the job done.

Comment
Add comment · Show 2 · 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 Mephilin · Apr 14, 2017 at 08:33 AM 0
Share

Thanks for fast reply!

Those planes use .png image with alpha (semi-transparent pixels at edges) as sprite. Can this be an issue?

avatar image FortisVenaliter Mephilin · Apr 14, 2017 at 03:13 PM 0
Share

Worth a shot.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Hiding a sprite partially (shader? masking?) 0 Answers

4.6 -> 5.0 Dramatic Performance Loss - No batching? 1 Answer

How do games like Octopath Traveler handle the angle of shadows, and is this even possible in Unity? [URP] 1 Answer

Want shadows from a semi-transparent receiver 0 Answers

How to create a Unity ShadowMapTexture 0 Answers


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