How to place a 3D model using ARKit iOS 11 with some custom background without using a camera?

I am working on an iOS app add-on for which I am using ARKIT iOS 11 beta. I am using ARSCNView (SceneKit) to render my .scn object. I followed the pattern set by the apple to create an ARSession ( https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip ). Is it possible to place a 3D model with a custom background instead of a camera?

How can a user select a background color or provide custom 2D photos as a background?

+1
source share
2 answers

scene, background :

 view.scene.background.contents = UIColor.red

 let myImage: UIImage = ... 
 view.scene.background.contents = myImage
+2

UIKit . @yaali, CameraContents . , background.contents, , , viewWillAppear. , ARKit AVCaptureVideoPreviewLayer ARSCNView.scene.background.cocntents.

    override func motionBegan(_ motion: UIEventSubtype, with event: UIEvent?) {
        if CameraContents == nil {
            CameraContents = sceneView.scene.background.contents;
            return
        }
        if cameraBackGround == true {
            sceneView.scene.background.contents = "Background_sky.png"
        }else{
            sceneView.scene.background.contents = CameraContents
        }
        cameraBackGround = !cameraBackGround

    }
0

Source: https://habr.com/ru/post/1679612/


All Articles