ARKit和ARCore具有估计环境光强度和颜色以进行逼真渲染的功能。
ARKit:https://developer.apple.com/documentation/arkit/arlightestimate?language=objc
ARCore:[https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/LightEstimate#getColorCorrection(float[],%20int)](https://developers.google.com/ar/reference/java/arcore/reference/com/google/ar/core/LightEstimate#getColorCorrection(float[],%20int%29)
它们都暴露了环境强度和环境颜色。在ARKit中,颜色以开尔文为单位,而在ARCore中,颜色是RGB颜色校正。
问题1:开尔文和色彩校正有什么不同,它们如何应用于渲染?
问题2:从相机帧估计光线强度和颜色的算法是什么?如果我们想自己实现它,有没有现有的代码或研究论文可以参考?
发布于 2020-02-06 20:24:59
ARCore的问题2:这是一篇关于How Environmental HDR works的研究论文
以下是关于environmental HDR in ARCore + Sceneform的简短摘要
希望它对您的搜索有所帮助:)
发布于 2020-02-08 19:15:35
假设您已经在"ship.scn“SCNScene中添加了一个名为' light‘的灯光节点,并将SCNLight附加到该节点,并且您的ViewController符合ARSessionDelegate,因此您可以获得每帧的灯光估计值:
class ViewController: UIViewController, ARSCNViewDelegate, ARSessionDelegate {
@IBOutlet var sceneView: ARSCNView!
override func viewDidLoad() {
super.viewDidLoad()
sceneView.delegate = self
let scene = SCNScene(named: "art.scnassets/ship.scn")!
sceneView.scene = scene
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let configuration = ARWorldTrackingConfiguration()
configuration.isLightEstimationEnabled = true
sceneView.session.run(configuration)
sceneView.session.delegate = self
}
func session(_ session: ARSession, didUpdate frame: ARFrame) {
guard let lightEstimate = frame.lightEstimate,
let light = sceneView.scene.rootNode.childNode(withName: "light", recursively: false)?.light else {return}
light.temperature = lightEstimate.ambientColorTemperature
light.intensity = lightEstimate.ambientIntensity
}
}因此,如果你调暗房间里的灯光,SceneKit也会调暗虚拟灯光。

https://stackoverflow.com/questions/60083858
复制相似问题