How to display stereo images in Apple Vision Pro?

Hi community,

I have a pair of stereo images, one for each eye. How should I render it on visionOS? I know that for 3D videos, the AVPlayerViewController could display them in fullscreen mode. But I couldn't find any docs relating to 3D stereo images.

I guess my question can be brought up in a more general way: Is there any method that we can render different content for each eye? This could also be helpful to someone who only has sight on one eye.

I have the same question.😭😭😭 There is nothing about the stereo image in the documents. Is there any solution you found?

Using Reality Composer Pro, you can make a custom material that feeds the left and right images into a GeometrySwitchCameraIndexNode.

The above Shader Graph from @mayoff works fine for me, using known good stereo image pairs. However, the preview on the Mac shows only a black material. You can only see the stereo output on actual hardware.

I the shader and named it TestStereo. Then I created a Cube in RCP, and changed the material from DefaultMaterial to TestStereo. When I did this, the cube became not quite opaque (I could now faintly see the grid through the cube). When I preview the scene on an actual Vision Pro, it looks great. Well, the stereo image part looks great, but I now have the image shown on all 6 faces of the cube. So I'll experiment with adding a billboard component (as seen in the SwiftSplash sample game, and build a simple Scene that I can drive with arbitrary left/right images.

The image shows a color difference between Reality Composer Pro and AVP, with AVP appearing noticeably brighter. What could be the reason for this? @mayoff thx:)

@kandao-xr I Believe that you are seeing this increase of brightness, because on your shader, you are adding the left image for both, LEFT camera index and MONO, that could be drawing two times (duplicating the brigthness of the image) when rendering the left Eye. Could you test just remove the Connection between left-image -> [mono]CameraIndex, to see if will solve?

thx for you repley, i remove mono to check, it's not work, when i use the previewsurface the color seem to normal, maybe it's the unlitsuiface problem

I encountered the same problem but was able to resolve it. A few things:

  1. When you create TextureResource from the image in Swift, make sure you set its semantic to color: TextureResource(image: cgImage, options: .init(semantic: .color)). I was setting it to nil before, and that's what made the images look pale.
  2. Use Unlit Surface node and turn off "Apply Post Process Tone Map"

Use two Input nodes to programmatically pass in images, extract the color and opacity of the images separately, and use an unlit material with tone mapping disabled to achieve the exact colors. The full code and Xcode project can be found on GitHub https://github.com/Lightning-Lion/StereoImages.

How to display stereo images in Apple Vision Pro?
 
 
Q