How to change camera orientation of SCNRenderer

Hello, I was wondering if anyone knows how to change the orientation of the SCNRenderer's camera using ARKit, perferably using SCNRenderer's render function. I'm trying to render the ARSCNView into a MTLTexture using a second SCNRenderer.


I am trying to get the same behavior as the ARSCNView, in which the 3D annotations are renderer correctly onto the screen. However, I have tried using both SCNRenderer's snapshot and render methods and they both produces images that has the camera feed (background) in the correct orientation but the annotations in the portrait orientation. Whenever I try to change the orientation of my point of view, the image is rendered in the incorrect orientation.


I know that ARSCNView has its own snapshot function which gives a UIImage of the camera feed and annotations in the correct orientation, but it does not preform fast enough for what I need.


Any help is appreciated.

  • Same issue, more details to recreate issue added here

Add a Comment

Replies

Hi there, I also have a similar problem. Did you manage to find a solution?

I am trying to create a photo mode for my AR app that is able to capture images at a higher resolution than is natively shown in ARSCNView. The snapshot method available on SCNView works, but it does not allow me to render at a higher resolution.

My solution was to create a seperate SCNRenderer, point it to the same scene as my AR scene and render it in the background using snapshot(atTime:with:antialiasingMode:).

This works great, except in landscape mode. The 3D content of the output rendered image is correct, but the background camera feed doesn't rotate as expected.

I have tried a few solutions:
Code Block
/* applying a rotation transform to the background seems to have no affect */
renderer.scene?.background.contentsTransform

Code Block
/* Drawing the SCNView directly - can't scale this up like I want to achieve */
sceneView.drawHierarchy(in: , afterScreenUpdates: )

Code Block
/* capturing the current frame camera pixel buffer & rendering manually. Couldn't get this to work */
sceneView.session.currentFrame?.capturedImage

Any help would be greatly appreciated.
same problem, any help?