Pik*_*ebu 3 augmented-reality scenekit swift arkit usdz
我正在将 .usdz 模型(从 Apple 下载)加载到我的ARSCNSceneView工作中。但不幸的是,该模型始终渲染为没有任何纹理并且显示为黑色。
// Get the url to the .usdz file
guard let usdzURL = Bundle.main.url(forResource: "toy_robot_vintage", withExtension: "usdz")
else {
return
}
// Load the SCNNode from file
let referenceNode = SCNReferenceNode(url: usdzURL)!
referenceNode.load()
// Add node to scene
sceneView.scene.rootNode.addChildNode(referenceNode)
Run Code Online (Sandbox Code Playgroud)
您的场景没有光,这就是物体显示黑暗的原因。只需向场景添加定向光即可:
let spotLight = SCNNode()
spotLight.light = SCNLight()
spotLight.light?.type = .directional
sceneView.scene.rootNode.addChildNode(spotLight)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2726 次 |
| 最近记录: |