How to apply 360 video as a texture in ARKit

Viewed 2238

I've been building a portal in ARKit, and while building out a virtual environment is easy to create and move around in, I would like to make the environment I would be entering a 360 video playing on repeat. I think it can be done by wrapping a 360 video as a texture to a sphere, but ARKit does not seem to have that option. Does anyone know how to do this?

An example of what I'm trying to do can be seen here: https://www.youtube.com/watch?v=xO2a7QTTAk4

2 Answers

In iOS 11, SceneKit can display video on any surface if you assign an AVPlayer to the corresponding material property's contents. (This doesn't (yet?) appear in the docs for that property, but was mentioned at WWDC and is noted in the headers.)

If your video content is projected right — aspect ratio 2:1, an equirectangular or "lat/long" projection — the 360 video should appear correctly when mapped onto a SceneKit sphere geometry (SCNSphere, non-geodesic).

You'll probably also need to set the material's cullMode and/or isDoubleSided properties to make sure the inside faces of the sphere render when the camera is placed inside it. And you should consider which material property to assign your texture map to so that it interacts correctly with lighting (emission is probably a good choice if you want to display the video unshaded).

Related