【问题标题】:Apply PBR Textures on 3D model using Image Based Lighting使用基于图像的照明在 3D 模型上应用 PBR 纹理
【发布时间】:2019-05-15 17:40:25
【问题描述】:

在 ARKit 2.0 中,我尝试使用 PBR 基础材料。使用.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 材料:

漫反射:https://prnt.sc/luwc40

粗糙度:https://prnt.sc/luwcl7

正常:https://prnt.sc/luwcuw

金属性:https://prnt.sc/luwdaz

【问题讨论】:

    标签: ios swift scenekit augmented-reality arkit


    【解决方案1】:

    如果您有一个分离的几何体(与框架分开的屏幕),则可以轻松地将纹理分配到这些部分。

    如果您有一个组合几何体(所有部分作为一个整体),那么为此类模型设置纹理的唯一方法是分配pre-made UV-mapped texture

    【讨论】:

      猜你喜欢
      • 2021-04-29
      • 2019-11-12
      • 1970-01-01
      • 2016-05-10
      • 1970-01-01
      • 2020-08-30
      • 1970-01-01
      • 2016-06-22
      • 2021-12-09
      相关资源
      最近更新 更多