ARKit - 适应光照条件

4

我目前正在学习在Unity和Swift中使用ARKit技术。

有人知道如何将我的物体的光线适应环境光吗?

谢谢!

1个回答

1
要启用 ARKit 的 光照估计,请使用以下代码:
  • Enable Light Estimation in viewDidLoad() method:

    configuration.lightEstimationEnabled = true
    
  • Exploit lightEstimate.ambientIntensity to update lighting:

    func renderer(_ renderer: SCNSceneRenderer, 
           updateAtTime time: TimeInterval) {
    
        guard let lightEstimate = sceneView.session.currentFrame?.lightEstimate 
        else { 
            return 
        } 
        spotLight.intensity = lightEstimate.ambientIntensity
    }
    
此外,您可以阅读 这个故事

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接