iosswiftscenekit

SceneKit USDZ file showing the wrong model


  1. I purchased a 3D model file, and its FBX format. I opened it in blender, and the model looks like this:

enter image description here

  1. Then I open it in Apple's Reality Converter, and it looks like this:

enter image description here

  1. Then I convert it into USDZ file. And import it into my Xcode project, which looks like this:

enter image description here

  1. Then I wrote some code, put it on screen. Guess what - the model is changed to something completely different:

enter image description here

I have attached a sample project here: https://drive.google.com/file/d/1NMhiYPR5u4ghw0voxbyOjiXOutj8aoEG/view?usp=sharing

I don't know what's going on with the model file. The company selling it seems legit. Maybe they exported the wrong FBX file? But how come it shows the correct model in blender and reality converter?


Solution

  • It seems, the method you use to import models does kind of inaccurate interpretation...

    I got your model (USDZ and/or converted SCN) working by using a slight different import mechanism)

    Add this extension somewhere:

    extension SCNNode {
        convenience init(named name: String) {
            self.init()
            guard let scene = SCNScene(named: name) else {return}
            for childNode in scene.rootNode.childNodes {addChildNode(childNode)}
        }
    }
    

    Then use it like so:

    override init() {
        super.init()
        
        let camera = SCNCamera()
        let cameraNode = SCNNode()
        cameraNode.camera = camera
        cameraNode.position = SCNVector3(x: 0, y: 0, z: 50)
        rootNode.addChildNode(cameraNode)
        
        // *** Changed Section ***
        let geo32 = SCNNode(named: "Audio_07.usdz") // or Audio_07.scn, if you converted it to SCN
        geo32.scale = SCNVector3(0.5, 0.5, 0.5) // OPTIONAL
        geo32.eulerAngles = SCNVector3(CGFloat.pi/2, 0.0, 0.0) // OPTIONAL
        rootNode.addChildNode(geo32)
        
    }
    

    This are the results:

    For the USDZ (I have no editor installed, you might need to adjust the materials) USDZ example

    For the converted SCN (I added some colors to the Materials) SCN example

    Hopefully this will help you.