1

I have a scene with a left and right SCNView that, when shown in Google Cardboard, gives a nice stereoscopic view. I'd like to add barrel distortion to my two views to correct for the different lenses in Cardboard.

Does anyone have some good suggestions on how I can do this using SCNView / Metal / SceneKit? I'd prefer not to drop down into OpenGL and mess with the renderer.

My thought is applying a transform to the SCNView might work well.

Thanks in Advance,

J.

Jason Leach
  • 3,889
  • 7
  • 37
  • 54
  • @rickster That's one old way to do it using OpenGL. Like I ask in my question, I would like to see a solution SCNView / Metal. Its not a duplicate. – Jason Leach Jan 15 '16 at 22:49

1 Answers1

-1

The MDLCamera class has a barrelDistortion property. I don't know if that would work for you though; you might need an inverse barrel distortion? MDLCamera is bridged to SCNCamera, but you must import SceneKit.ModelIO (as noted in your OBJ import answer.

Sounds like a cool blog post once it's working!

Community
  • 1
  • 1
Hal Mueller
  • 7,019
  • 2
  • 24
  • 42
  • 3
    Model I/O was designed as a format that you can use to import and export assets. While SceneKit offers utils to load assets represented as Model I/O objects, it's not true that everything Model I/O can represent is supported by SceneKit. Many properties of `MDLCamera` are not supported by SceneKit, and `barrelDistortion` is one of them. – mnuages Jan 14 '16 at 10:32
  • What happens if I create an MDLCamera that has properties that don't exist in SceneKit? Do I get a best effort translation, or a completely stock SCNCamera, or are the results undefined? Do the SCNCamera focal parameters reflect the MDLCamera aperture/lens/etc. ? – Hal Mueller Jan 15 '16 at 06:44
  • Model I/O is, in some sense, an interchange format specification. It *describes* aspects of scene graphs and assets, but doesn't do anything more than describe. It's up to higher-level tools to read the description and do whatever they can with it. In the case of SceneKit, one can safely assume that if you import a MDL object of some sort as the corresponding SCN class, only features that said SCN class has API for will be imported. – rickster Jan 15 '16 at 19:16