Has anyone had the issue with Unity 5 shadows not rendering when upgrading from Unity 4 to Unity 5 when using a custom projection matrix as mentioned here:
In Unity 4, as long as you had the rendering in Forward rendering and had certain quality settings the shadows would show up, but now upgrading to Unity 5, the shadows only show in the editor scene view, but not the game view with the same settings. Is there additional setup or something I need to change?
Our shadows have stopped working in builds since upgrading to 5 and switching to deferred, but they run fine in the editor. But I don’t believe we use a custom matrix
@Alabatross , the shadows appear in the Editor’s scene view, but not in the Editor’s Game View when not in play mode. In play mode, nothing shows up as well in game view. This is in forward lighting mode.
In Unity 4 they still kind of worked, but in 5 they don’t appear at all.
Is there a new or better way to access shadows, or make our own shadows with shaders in Unity 5? Unity 4 made it kind of a pain.
@KEngelstoft , could you ask someone on the team if this is a bug, or if this is an intended functionality in Unity 5, and there are specific steps we need to take to get shadows to work correctly with custom projection mtrices, as it does in Unity 4? I was going to file a bug report, but I didn’t want to do that unless somebody could confirm this is a bug or not. Thank you.
Just to make sure I’m also having this same issue,
I see the amazing new lighting just fine in the editor, but there are no shadows in the build. (Aside from some shadows on trees that appear to clip through the terrain)
Is that the same issue as yours?
(Image below shows my issue, editor on the left, build on the right)
It’s odd, it seems like the terrain isn’t receiving shadows.
The trees in the build have the correct shadows, and project shadows correctly onto other trees.
I guess it’s possibly a Unity bug. What OS are you running? Not that it should make any difference but I’m on Windows 8.1 Pro, exporting my builds for Windows. (Both x86 and x64)
I also have this problem on a custom projection matrix, I don’t have shadows on Unity 5 (had them fine on Unity 4) but if I increase enough the near clip plane they appear but not correctly, they go through objects emmiting the shadows and the shadows direction changes when I rotate the camera (also in my case I recompute the projection matrix according to the camera rotation).
Might I ask how to access the near and far during shadow map rendering? Do we need to do this through a shader? I’m kind of unsure how to access shadow maps in Unity 5’s new shader setup.
I’m sorry but I don’t really understand what I should do, if it’s about shaders I don’t know where to start i never tried yet to mess with them.
All I do is modifying the camera projection matrix in a LateUpdate, no render to texture (Unity free version).
I tried to find something else in the manual and api refering to a near and far plane but without success, only cameras seem to have those so I was thinking maybe you meant to set my near plane using the api rather than the editor.
Just in case I did it (set to 15f in my scene) before and after the matrix modification but no changes.
I’ll make a video of what happens normally, what it does when I activate my custom matrix then adjust the near plane to show what happens with shadows. I just need the time to encode and upload, I’ll maybe edit this post to share the link.
UPDATE:
I warn you my spoken english is REALLY bad.
Shadows direction is wrong, not depending of the directional light orientation, depends of the camera orientation. Also appearing above objects, as if depth was wrong somewhere, not able to know if an object is supposed to be in front or behind of the shadow emitter.
At the end of the video I don’t know what I want to say, it’s just to show quiclky how GL computes shadows step by step with the projection matrix, maybe someone more used to work with this will see something interesting.
I setup a .unitypackage for Unity 5 with my scene here. It can be downloaded and run. You can see that no shadows appear whatsoever in Forward rendering with the custom projection matrix. To move the skewed camera left/right/up/down, just click and hold the left mouse button and drag the mouse around.
Also, it’s worth noting this is how I currently feel:
For anyone that is absolutely stuck with this issue and needs it to work now, the Sunshine plugin with the right settings will get the shadows working again in Unity 5. It’s not a cheap plugin, but it at least does what Unity 5 should be doing.
If you have questions on how to setup Sunshine to work with the custom projection matrix, I spoke with the Sunshine developer and he generously walked me through how to do it. Now that’s what I call great customer service. You can PM me if you want the steps to getting Sunshine setup correctly with the custom projection matrix.