如何将光泽效果应用于 3D 模型?

How to apply Glossy effect to 3D Model?

我想在 3D 模型上应用光泽效果,我正在使用 SceneKit 加载 3D 模型。 我已经应用了 metalnessroughness 属性,但是它看起来像下面的屏幕截图,并且 metalnessroughness 没有在旋转时更新:

model.capsuleModel.geometry?.firstMaterial?.lightingModel = .physicallyBased
model.capsuleModel.geometry?.firstMaterial?.metalness.intensity = 0.5
model.capsuleModel.geometry?.firstMaterial?.roughness.intensity = 0.5

I want something like this

可以使用以下代码添加光泽效果:

let material = SCNMaterial()
material.locksAmbientWithDiffuse = true
material.lightingModel = .phong
material.diffuse.contents = UIColor.darkGray
material.specular.contents = UIColor.white
material.shininess = 0.1
sceneView.scene?.rootNode.childNodes.first?.geometry?.materials = [material]