gpt4 book ai didi

swift - ARKit——适应光照条件

转载 作者:搜寻专家 更新时间:2023-10-31 23:08:23 24 4
gpt4 key购买 nike

我目前正在学习在 Unity 和 Swift 中做一些 ARKit 的事情。

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

谢谢!

最佳答案

To enable ARKit's Light Estimation use this code:

  • viewDidLoad() 方法中启用光照估计:

    configuration.lightEstimationEnabled = true
  • 利用 lightEstimate.ambientIntensity 更新光照:

    func renderer(_ renderer: SCNSceneRenderer, 
    updateAtTime time: TimeInterval) {

    guard let lightEstimate = sceneView.session.currentFrame?.lightEstimate
    else {
    return
    }
    spotLight.intensity = lightEstimate.ambientIntensity
    }

此外,您还可以阅读 THIS STORY .

关于swift - ARKit——适应光照条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47464650/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com