Search code examples
swiftaugmented-realityscenekitarkitvirtual-reality

Stereo ARSCNview to make VR and AR mix


I want to make a mix of virtual reality and augmented reality. The goal is I have a stereo camera (for each eyes).

I tried to put two ARSCNView in a viewCotnroller but it seems ARKit enable only one ARWorldTrackingSessionConfiguration at the same time. How can I do that?

I researched to copy the graphic representation of a view to past this to an other view but impossible to find. Please help me to find the solution.

I found this link, maybe can it illumine us: ARKit with multiple users

Here's a sample of my issue:

https://www.youtube.com/watch?v=d6LOqNnYm5s

PS: before unlike my post, comment why!


Solution

  • The following code is basically what Hal said. I previously wrote a few lines on github that might be able to help you get started. (Simple code, no barrel distortion, no adjustment for the narrow FOV - yet).

    Essentially, we connect the same scene to the second ARSCNView (so both ARSCNViews are seeing the same scene). No need to get ARWorldTrackingSessionConfiguration working with 2 ARSCNViews. Then, we offset its pointOfView so it's positioned as the 2nd eye.

    https://github.com/hanleyweng/iOS-Stereoscopic-ARKit-Template