The problem seems to be in your loading method. Use Entity.load(named:)
instead of Entity.loadModel(named:)
. To find out what shader is used for each model's part, use this code:
import UIKit
import RealityKit
class ViewController: UIViewController {
@IBOutlet var arView: ARView!
override func viewDidLoad() {
super.viewDidLoad()
let usdz = try! Entity.load(named: "car.usdz")
let anchor = AnchorEntity()
anchor.addChild(usdz)
arView.scene.anchors.append(anchor)
print(usdz) // full scene hierarchy
let firstAnchor = arView.scene.anchors.first
let entity = firstAnchor?.findEntity(named: "wheel") as? ModelEntity
guard let materials = entity?.model?.materials else { return }
for material in materials {
print(material)
}
}
}
Result:
