spatial scene 原理

Asked on 06/16/2025

1 search

Spatial scenes are a new type of 3D image introduced in RealityKit, which are generated from existing 2D images or photos. They create a diorama-like version of a photo with real depth, allowing for motion parallax as the viewer moves their head relative to the scene. This makes the images feel more lifelike and immersive.

To create a spatial scene, you don't directly initialize the image presentation component from the image URL. Instead, you create a spatial 3D image from the URL and use it to initialize the image presentation component. The spatial scene is then generated using the Spatial 3D Images Generate method, which updates the component's available viewing modes to include Spatial 3D and Spatial 3D immersive modes. This allows for either windowed or immersive presentation of the spatial scene.

For more details on how to implement this, you can refer to the session What’s new in RealityKit (16:28).