Search code examples
scenekitaugmented-realityarkitshadowlag

Reduce Application Lag while using shadows in SceneKit


I am working on a 3D map in SceneKit. When I enable the Cast Shadow Property of a directional light in SceneKit, the shadows appear, but the application becomes very slow.

How do I reduce the lag while still maintaining shadows in the scene?


Solution

  • Use Fake Shadows (shadows generated as a texture in 3D authoring or 2D authoring app) rather than True Shadow Map. To apply fake shadows as a texture for 3D plane use PNG file format with premultiplied alpha channel (RGB * A). It considerably reduces Processing and Memory Usage when using shadows in RealityKit or SceneKit.

    enter image description here