• 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 pedronaroga · Jul 19, 2012 at 05:03 PM · shadowsissuerenderrealtime

Realtime shadows don't always render

As you can see on the screenshot below, some of my walls are rendering realtime shadows, others are not. I know it's better to use lightmapping for static objects and I do intend to bake it later, but I was wondering why that happened. It also happened with a couple of other objects in my scene.

They are all using a Diffuse shader, have a BoxCollider (they actually have mesh colliders, but I already tried replacing them for boxcolliders, not$$anonymous$$ng different happened), have both Cast and Receive shadows marked on the renderer component, and I already tried switc$$anonymous$$ng from 'static' to 'not static'. Unity Pro.

There's only one directional light in my scene and I'm using forward rendering.

Why is it happening?

alt text

alt text

realtime_shadow.png (189.9 kB)
realtime_shadow2.png (260.9 kB)
Comment
Add comment · Show 5
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 pedronaroga · Jul 19, 2012 at 05:29 PM 0
Share

Additional info: Using the same building model on a totally new scene (without any other objects in the scene) seems to work. I have not touched the colliders/renderers/materials, but I have changed the layers and set the walls to static.

I was wondering if there was perhaps a "shadow count limit" for realtime shadowed objects (it's the only explanation I could come up with, seeing the only thing different here are the layers and static option - which I already tried changing).

avatar image Alayna · Jul 19, 2012 at 06:08 PM 0
Share

Is it possible that some of your walls are set to layers that are excluded from the real time lights? All lights have a Culling Mask in the inspector, if the objects you want to cast shadows are on a layer not ticked in the culling mask of the light they wont cast shadows. As far as I know there isn't a limit to the amount of objects casting real time shadows.

avatar image Kryptos · Jul 19, 2012 at 06:13 PM 0
Share

Are all walls in the same layer?

avatar image pedronaroga · Jul 19, 2012 at 06:17 PM 0
Share

All walls are in the same layer, and the Directional Light culling mask is set to "Everything". :(

avatar image pedronaroga · Jul 19, 2012 at 06:40 PM 0
Share

More additional info: it works fine if I switch my Rendering Path from forward rendering to deferred lighting.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kryptos · Jul 19, 2012 at 06:14 PM

There might be somet$$anonymous$$ng wrong with the normals on your wall mesh. The shadows from the trees should be stopped by the walls.

What happens when you rotate the walls that are not casting shadow by 180 degrees around the y-axis?

edit: obviously, normals are not the issue here. I keep t$$anonymous$$s answer because of the comments above.

Comment
Add comment · Show 7 · 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 pedronaroga · Jul 19, 2012 at 06:20 PM 0
Share

Nothing happens when I rotate my walls...

Since the normals are generated from importing the model (and I can change its configurations on the FBXImporter), it shouldn't work on a different scene if that was the case, should it? If I add the exact same model on another scene, it works :(

avatar image pedronaroga · Jul 19, 2012 at 06:26 PM 0
Share

Also, changing from the Normals from "Import" to "Calculate" on the FBXImporter doesn't fix the problem. Changing from "Import" to "None" makes everything dark (duh!). Is there anywhere else I can experiment with normals without editing the model inside 3DS MAX?

avatar image Alayna · Jul 19, 2012 at 06:30 PM 0
Share

I did a small test with point lights casting shadows on either side of a plane with only normals on one side. Both lights cast shadows, so I don't think that normals are the problem in this case.

avatar image pedronaroga · Jul 19, 2012 at 06:35 PM 0
Share

Point lights shouldn't cast shadows in forward rendering, should they? I have a lot of point lights in my scene (I just hid the gizmos on the screenshots above - sorry I forgot to mention that)... should it interfere with the shadows?

avatar image Alayna · Jul 19, 2012 at 06:43 PM 0
Share

Ah, no point lights dont cast shadows in forward rendering, but I checked it again with a directional light and the normal had no effect on casting shadows in that case either. I had my scene in Deffered Rendering before so I didnt notice it at first sorry.

Edit: Speaking of which, if you change it to Deffered for a moment, are the shadows the same?

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

Lightmapping makes realtime shadows jagged/blocky 0 Answers

RealTime Shadows don't work after build. 0 Answers

Problem with ligthing on voxels 1 Answer

Transparent Diffuse issues 1 Answer

Realtime shadows against a lightmapped surface on mobile devices 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