1
votes

I'm very new to ARKit and SceneKit and 3D modelling/Blender 2.8, so bear with me, and apologies for the long detailed explanation, I just feel like I'm missing something simple and there aren't many guides online, that I can find, about how to do this.

I'm trying to build my own animoji/memoji with ARKit and Scenekit and I'm trying to export it to .dae/.scn and access all of the Blend shapes, to be able to modify them with ARFaceAnchor blend shapes.

So I have my 3d model with all the necessary blend shapes: 3D model

I've exported the 3d model from Blender to COLLADA (.dae) with the following selected: main - Selection only, Include Shape Keys

geom - Apply Modifiers - View Triangulate

If I then open the .dae file in a text editor, I can see all of the Blend shapes and materials in there.

.dae file

I then import the file into my .scnassets folder and get the following entities: entities

I've managed to find some example .scn files that contain the blender shapes as geometry morphers at this stage. However, mine just contains the following, with no ability to add them. geometry morphers

I set my scene up and the SCNNode works correctly, appearing inside the view. I can't find the blend shapes anywhere in this the SCCNode either.

 func sceneSetup() {
        let scene = SCNScene()
        DispatchQueue.main.async {
            if let filePath = Bundle.main.path(forResource: "smiley_8.16-1", ofType: "dae", inDirectory: "Models.scnassets") {
                let referenceURL = URL(fileURLWithPath: filePath)
                self.contentNode = SCNReferenceNode(url: referenceURL)
                self.contentNode?.load()

                scene.rootNode.addChildNode(self.contentNode!) 
            }
        }

        sceneView.scene = scene

        sceneView.allowsCameraControl = true
        sceneView.backgroundColor = UIColor.gray
    }

I'm assuming I have to set up an SCNMorpher somewhere, to access the blend shapes. But if I can get some pointers as to how and where. Also if anyone knows how I can set up the morpher as an attribute in the node inspector, that would be great.

1

1 Answers

0
votes

You need to add instance_controllers to your Blender dae file so that SceneKit can correctly read the blend shapes. You can use this great tool to fix your file before importing it to SceneKit. Then, the shape keys appear in Xcode SceneKit editor and you can modify then in code with the SCNMorpher class.