- Home /
Behavior of Realtime Shadows on iOS
I'm attempting to simplify rendering of a complex 3D scene by using a screenshot as a backdrop behind a few dynamic models. The dynamic objects cast shadows onto an invisible plane using a technique adapted from https://github.com/keijiro/ShadowDrawer. The setup looks like this:
Unity 2017.4.2, forward rendering
- Screenspace camera canvas with backdrop image, rendered with camera depth -1, clear solid color
- Dynamic models casting realtime shadows from a single directional light, rendered with camera depth 0, clear depth only
- Screenspace overlay UI canvas
Everything looks good when run in the editor, but when running on iOS the entire scene behind the 3D models is black. If I deactivate the models, the backdrop shows, but obviously no models or shadows are rendered. If I turn off shadows on the light, the scene looks correct except obviously no shadows are rendered.
What might differ in the implementation of realtime shadows between desktop and iOS to cause this behavior? I'd really like to keep the realtime shadows, so any suggestions or workaround is appreciated.
Answer by jvisenti · Jun 18, 2018 at 10:44 PM
Solved the problem in a different way using a single camera. The camera now renders all layers and the background is simply a Screenspace Camera canvas with an image that uses a clone of the UI default material, but with Geometry - 1 render queue. With this setup the background is rendered first, and the realtime shadows appear correctly on top of it.
Still curious why the first setup didn't function properly, I'm thinking it's a Unity bug.