- Home /
Disabling dynamic shadows in deferred rendering (Unity 5)
Hi,
We are using Unity 5, and we would like to switch to using deferred rendering to avoid the CPU cost of doing a separate rendering pass to generate the depth buffer that is incurred with forward rendering.
However, upon trying to use the deferred pipeline, the CPU cost was even greater than with forward due to shadow map rendering. In forward rendering, the objects in question had their shadows baked into lightmaps and thus shadow map rendering time was minimal. With deferred, even if the objects are set to Static and baked into lightmaps, they are still being rendered into a dynamic shadow map. There is only one shadow-casting light in the scene (a directional light).
We would like to be able to avoid rendering dynamic shadows for our static world geometry. However, we cannot turn off shadow casting because this also causes them to not affect lightmaps. I can see one of two potential solutions:
1) Unity is changed to separate "Cast Shadows" into two separate options--one for static shadows (lightmaps, etc.) and one for dynamic shadows.
2) We modify the shaders used by our environment geometry to not allow casting shadows. I'm not sure if this is possible with deferred rendering (possibly a #pragma?). If it is, please inform me of how to do it, as I could not find any documentation.
Answer by DissidentDan · Apr 23, 2015 at 08:42 AM
I discovered a tag that does this.
"ShadowSupport" = "False"
However, our shaders were made with Shader Forge, which does not support adding user-specified tags. It would be great to have such a feature.
Your answer
Follow this Question
Related Questions
Baked + Real-Time Shadows 6 Answers
Shadowmask shadows not showing 0 Answers
How to store directional light shadowmap? 1 Answer
Shadows look bad or not show at all 0 Answers
How to prevent holes in shadows without generating Shadow Acne? 1 Answer