I just stumble upon an interesting fact that seems to be noted nowhere in the documentation.
I have a point light inside a Lantern that cast shadow on the ground. When I switch the camera (or the scene preview) to orthographic, the shadow disapear!
When I go check the setting of my light, there is a little warning that have appear on my light that say that in forward rendering, only directional light can cast shadow. But I just change the projection, everything is still set on deferred!
Is this an intended behaviour or a bug? Because orthographic is just a different projection amtrix, so it shouldn’t mess up neither with shadow map nor deferred rendering, no?
Yes of course, I’ve checked in my Player Setting and ON my camera, each are set to Deferred.
And I’ve the shadow drawn when in perspective (and only deferred have shadow for point light) and when I switch to orthographic the Shadow disappear. Both in game view (so throught a camera set on ortho) and on the Scene Preview (so by right clicking on the little cube and unchecking “Perspective”).
So it would seems its a limitation : orthographic camera cannot be on a deferred path, but I find this strange since it’s just a switch of projection matrix…
Note to anyone having the same problem I did: Directional Lights should work in Orthographic. If they’re not, you probably baked a lightmap that you need to clear.
I’ve run into the exact same issue in 3.5 beta, did you ever find out what was wrong Sirithang?
Toggling the camera between Perspective and Orthographic disables shadows on points lights and gives a “only directional lights can have shadows in forward rendering” warning. This happens in a fresh project, with an empty scene except for a camera and a point light.
I’ve checked with the 3.5 beta and same issus as with 3.4 and 3.4.2f*…
It work only with directional light, they give shadow, but point/spot don’t give shadow with an ortho camera. Would it be an engine restriction? as shader can’t transform from a perspective shadowmap to an ortho camera point of view? Why does it work with directional light then? Because the shadow map being already in orthographic the conversion is possible?
Would lvoe to hear an official response on that, is there a mean to submit this to the Unity team, or should I send a mail?
I have seen a few threads mentioning this now, but never an official response confirming whether or not it is working as intended… I submitted a bug about it anyway, can’t hurt.
Yes, it’s an unfortunate performance choice we had to do - deferred does not work with orthographic cameras. The reason was that we did not want to slow down perspective+deferred case just to make it possible to use orthographic projection.
I needed the data from the deferred render pipeline but wanted an orthographic view so i putting an orthographic projection matrix in to a perspective camera projection matrix to trick the pipeline and it works
Does it also applies to a perspective camera using an orthographic projection matrix?
Here is an test project where I use a little script to apply an orthographic projection matrix to a perspective camera with deferred lighting enabled.
The scene contains a point light that should produce dynamic shadows.