1

I have a valid .USDZ file format for a 3d model from the following link I would like to add to my SceneKit application in Xcode.

https://solarsystem.nasa.gov/resources/2392/earth-with-clouds-3d-model/

However, as seen in the following error:

Error Image

XCode is not rendering my .USDZ file format.

I am on a MAC VM - Montery OS 12.6.1 using VMWare. Everything is valid in terms of trust with apple servers and for other apps I can run them on my iPhone. Also, I have Python 3.7 as well as USDCONVERTER installed on my VM. However, I also have Reality Converter installed and whenever I run the application it says "Reality Converter quit unexpectedly."

Likewise, in Xcode when I click on the Earth.usdz file nothing renders and again I get the "Not Applicable" in the side bar.

I have no idea why this is occuring and would like to know why I am unable to render these objects in XCode. Any help is greatly appreciated. Thank you!

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
  • Did you test this using an alternative model? Does is behave the same? – ZAY Oct 26 '22 at 07:29
  • @ZAY. Yes, I tested other USDZ files and tried other formats such as gITF and DAE. Still nothing seemed to be rendering. – David Rohweder Oct 26 '22 at 20:07
  • If you speak of rendering - do you mean, tha render/visualization inside of XCode itself? the Visual Scene-Graph Editor? Or do you mean, the compiled Application running on a Device? I assume you have installed the latest XCode? The Issue you run into "could" be related to the effect, that you are using a VM-Mac, instead of a real Hardware Computer, such as iMac. I know that in the past (let's say, some 1.0 - 1.5 years) ago, there was a problem displaying .OBJ files with the Scene-Graph Editor. Currently I figure no issues with all the 3D Assests than come along. I use plenty of them. – ZAY Oct 27 '22 at 07:46

1 Answers1

3

Your .usdz scene may be damaged or corrupted. But somehow it's rendered SOMETIMES. There's also a problem with its scale: the sphere is bigger 1000 times (i.e. its local size is 1000 meters).

import SceneKit

class GameViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let sceneView = self.view as! SCNView
        sceneView.autoenablesDefaultLighting = true
        sceneView.allowsCameraControl = true
        sceneView.backgroundColor = .black
        let scene = SCNScene(named: "art.scnassets/Earth.usdz")!
        sceneView.scene = scene

        if let earth = scene.rootNode.childNode(withName: "Cube_002", 
                                             recursively: true) {
            earth.scale = SCNVector3(0.09, 0.09, 0.09)
        }
    }
}

Xcode 14.1 RC 2, macOS 13.0, iOS 16.1 simulator.

enter image description here

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220