当模型的材质配置为使用Blinn光照模型时,此Wavefront模型(https://poly.google.com/view/100p3RNw-5Q)变为像素化,如屏幕截图所示。默认照明模型不会出现这种情况。
是否有一些SceneKit设置可以缓解这种像素化?当您在灯光前旋转模型时,像素化就会出现。
代码:
let modelNode = scene.rootNode.childNodes.first!
if let g = modelNode.geometry {
// Loop over each face
for m in g.materials {
// Use Blinn lighting model
m.lightingModel = .blinn
}
}
fileprivate func addLightNodes(cameraNode: CameraNode) {
// Create ambient light
let ambientLightNode = SCNNode()
ambientLightNode.light = SCNLight()
ambientLightNode.light!.type = .ambient
ambientLightNode.light!.color = UIColor(white: 0.75, alpha: 1.0)
// Add ambient light to scene
scene.rootNode.addChildNode(ambientLightNode)
// Create directional light
let directionalLight = SCNNode()
directionalLight.light = SCNLight()
directionalLight.light!.type = .directional
directionalLight.eulerAngles = SCNVector3Zero
directionalLight.light!.color = UIColor(white: 0.60, alpha: 1.0)
// Add directional light to camera
cameraNode.addLightToCamera(light: directionalLight)
}
答案 0 :(得分:1)
确实它看起来像三角形Z战斗。 您只能拥有一个节点,但模型中有重复的三角形,因此您必须在DCC中进行检查。