Lab 026 – Using Dynamic Lights and Shadows with Passthrough

We can use ShadowReceivingOcclusionSurface to enable virtual lights and shadows to affect our real space.

Overview

I saw this question on the Apple Developer Forum this morning. To paraphrase: can our virtual dynamic lights impact our real world when using passthrough in a full space?

I had tried to do this during the Vision Hack in September, but I didn’t get it working. Since that time I’ve learned about the Occlusion Material. In particular, the shader graph node called “ShadowReceivingOcclusionSurface” will be useful here.

This lab doesn’t have any code. All the work was done in Reality Composer Pro. We simply load the scene and add a drag gesture we can move the cubes.

  • We have two cubes for the fake floor. One of these is using the ShadowReceivingOcclusionSurface node while the other is using a PBR material.
  • We have two small cubes that can move around. These will receive light and cast shadows.
  • A small sphere helps us visualize the spotlight

Watch the Video Demo

Support our work so we can continue to bring you new examples and articles.

Download the Xcode project with this and many more labs from Step Into Vision.

Questions or feedback?