Dynamic shadows on invisible plane in ARKit

I know somewhere in one of the Apple videos they show how to project shadows from a directional light onto an invisible plane in ARKit but I can't find it for the life of me.


Can anyone point me in the right direction? Something to do with deferred shadows?


cheers


Toby

Accepted Reply

If you're using ARSCNView, you might be referring to SCNLight's new shadowMode (deferred option). This is covered in WWDC '17 What's New in SceneKit (timecode 45:15): https://developer.apple.com/videos/play/wwdc2017/604?time=2715

Replies

If you're using ARSCNView, you might be referring to SCNLight's new shadowMode (deferred option). This is covered in WWDC '17 What's New in SceneKit (timecode 45:15): https://developer.apple.com/videos/play/wwdc2017/604?time=2715

Thank you, that's it. I was looking in all the ARKit videos not scenekit. I was actually hoping to use the same trick to render shadows on an invisible plane in a regular Scnview with a transparent background but sadly no luck. It looks like it needs the camera feed to blend the shadows with.

Not working on ARKit 3.0, shadow not appear on screen but appears in Debug View Hierarchy, and Xcode crash when i click SCNScene...It works fine on ARKit 2.0 with the same code.

Starting with iOS 13, you have to set the colorBufferWriteMask on the invisible plane's material to SCNColorMask.alpha instead of []. Example:


floorNode.geometry?.firstMaterial?.colorBufferWriteMask = SCNColorMask.alpha

Thanks for helping. I try this before, shadow did appear but the plane was translucent, not invisible. Anything I missed?