Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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
4
Question by Alkann · Mar 11, 2015 at 09:16 AM · unity 5camerashadowsmatrix

Camera custom matrix, shadows not working anymore - Unity5

Hello, First time I have to ask people to help me with a problem, I usually try to find by myself but here I think it could take a lot of time.

Some months ago I made a custom matrix projection for my camera (Camera.projectionMatrix) and it always worked perfectly, no shadows filckering, no objects disappearing so near and far clip planes work finely. I just had to increase the values for the far plane and in Quality settings increase the value for max distance shadow to avoid having them flickering. I can't avoid to use my custom camera it's the "key" to play my game, the matrix is ajusted to give a specific view of the scene according to the position and orientation between the mobile screen and the user face.

The problem appeared with Unity 5, now I don't have shadows anymore whatever the values applied to far plane and max distance for shadows, when I switch back to the normal mode by deactivating my matrix modification in real time I can see the shadows but with my custom matrix I have no shadows. My objects are ~100 unity far from my camera, my near plan is 0.3 and far plane 1500 I found my shadows reappear when increasing the NEAR plane to ~20 but their behaviour is really strange, they rotate according to the camera orientation.


Do you know if there have been changes with the way shadows are computed between Unity 4 and 5? If so what had been changed or is there a way to go back to the way they acted in Unity4. If I find nothing I will have to go back to Unity 4 but Unity5 seems more interesting and next updates won't happen on 4 so it would really be better to find a way to make it work with u5.


I don't think it would be useful to let my code on this work with matrix projection since it's not simple at all to understand why I put this or that value here or there but I can at least give for an example my custom matrix and the original one but I don't think it will help.

 29 fov, 27 near, 1500 far.

Here is my matrix with a normal behaviour :

 2.17622    0.00000    0.00000    0.00000
 0.00000    3.86671    0.00000    0.00000
 0.00000    0.00000    -1.03666    -54.98982
 0.00000    0.00000    -1.00000    0.00000

and here is the custom one with the same situation :

 2.13346    0.00000    0.00000    0.00000
 0.00000    3.79075    -0.00144    0.00000
 0.00000    0.00000    -0.51833    -27.49491
 0.00000    -0.00038    -1.00000    0.00000


As you can see no big differences but it seems like the way shadows are computed with the matrix projection changed between Unity 4 and 5.

Comment
Add comment · Show 2
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 Ben-BearFish · Mar 12, 2015 at 09:35 PM 1
Share

I have the exact same issue and have not found a solution as of yet. I've posted in the forums here: http://forum.unity3d.com/threads/unity-5-shadows-do-not-render-in-game-view-with-custom-projection-matrix.307143/#post-2011336

As far as I know and read, there were indeed changes to the shaders and techniques used to render shadows in Unity 5, though there is not an exact reference on what or how to access them. Hopefully someone will figure out how to solve the issue. We could also send this to issue/bug tracker to Unity.

avatar image sbsmith · Mar 11, 2016 at 04:58 AM 0
Share

A year later and I am in the same boat. I have tried this on 5.3.2 and 5.4.0b9 and my shadows disappear as soon as my matrix becomes oblique. So, the custom calculated matrix works fine while the frustum is symmetrical, but once the camera shifts and forces it to become oblique, the shadows disappear.

1 Reply

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

Answer by monark · Nov 10, 2016 at 01:48 PM

See the fix here: https://issuetracker.unity3d.com/issues/shadow-moves-in-relation-to-the-object-that-casts-it-when-using-a-custom-projection-matrix

Only good though if you are on 5.4 or higher

Comment
Add comment · Show 1 · 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 Bunny83 · Nov 10, 2016 at 02:35 PM 0
Share

Thanks for the update. Such answers are always welcome ^^.

Since the OP wasn't online since dec 2015 I'll accept this answer.

Another case closed :)

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

7 People are following this question.

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

Related Questions

How to set the position of objects on the left and right of the screen 0 Answers

How do I render a scene's depth buffer when I have custom vertex shaders? 0 Answers

Shadows from culled objects 0 Answers

Need help for player rotation and camera rotation 0 Answers

What's going on with rendering? 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