在 ARKit 2.0 中,我尝试使用 PBR 基础 Material 。使用 .obj
文件格式的 3D 模型。
问题:我看不到深色产品。我不确定它是否与在 SceneKit 中设置适当的照明有关。请帮助我如何在 ARKit
/SceneKit
中设置 PBR 基础光照。
试试下面的代码:
//Set lighting
let light = SCNLight()
light.type = .ambient
node.light = light
// if light estimation is enabled, update the intensity
// of the model's lights and the environment map
if let lightEstimate = self.session.currentFrame?.lightEstimate {
self.enableEnvironmentMapWithIntensity(lightEstimate.ambientIntensity / 1000.0)
} else {
self.enableEnvironmentMapWithIntensity(6)
}
// Call environment Map
func enableEnvironmentMapWithIntensity(_ intensity: CGFloat) {
if sceneView.scene.lightingEnvironment.contents == nil {
if let environmentMap = UIImage(named: "Models.scnassets/sharedImages/environment_blur.exr") {
sceneView.scene.lightingEnvironment.contents = environmentMap
}
}
sceneView.scene.lightingEnvironment.intensity = intensity
}
要求的结果:http://prntscr.com/luwlax
作为引用,附上 PBR Material :
最佳答案
如果您有一个分离的几何体(屏幕与框架分开),很容易将纹理分配给这些部分。
如果您有一个组合几何体(所有部分作为一个整体),对此类模型进行纹理处理的唯一方法是分配 pre-made UV-mapped texture .
关于ios - 使用基于图像的光照在 3D 模型上应用 PBR 纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53779925/