当我使用SceneKit和ARKit时,如何在原生iOS中启用Vuforia的光照估计?

时间:2018-01-22 04:15:48

标签: scenekit vuforia arkit lighting

我正在SCNScene中为VuforiaEAGLView编写场景节点。

 fileprivate func createMyScene(with view: VuforiaEAGLView) -> SCNScene {
    let scene = SCNScene(named: "Models.scnassets/sun/DAE_SUN.dae")
    guard scene != nil else {
        print("Scene can't be load")
        return SCNScene()
    }

    boxMaterial.diffuse.contents = UIColor.lightGray

    let omniLightNode = SCNNode()
    omniLightNode.light = SCNLight()
    omniLightNode.light?.type = .omni
    omniLightNode.light?.color = UIColor(white: 0.75, alpha: 1.0)
    omniLightNode.position = SCNVector3(x:50, y:50, z:50)
    scene?.rootNode.addChildNode(omniLightNode)

    let ambientLightNode = SCNNode()
    ambientLightNode.light = SCNLight()
    ambientLightNode.light?.type = .ambient
    ambientLightNode.light?.color = UIColor(white: 0.87, alpha: 1.0)
    scene?.rootNode.addChildNode(ambientLightNode)

    let spotLightNode = SCNNode()
    spotLightNode.light = SCNLight()
    spotLightNode.light?.type = .spot
    spotLightNode.light?.color = UIColor(white: 0.87, alpha: 1.0)
    spotLightNode.position = SCNVector3(x:10, y:10, z:10)
    scene?.rootNode.addChildNode(spotLightNode)


    for node in (scene?.rootNode.childNodes)! {
        if node.name == "sun" {
            node.position = SCNVector3Make(0, 0, 0)
            node.scale = SCNVector3Make(0.5, 0.5, 0.5)
        }
    }
    return scene!
}

然而,光线不对。而且,我也想通过ARKit开启照明估算。我看到了Vuforia support says the new Vuforia SDK support ARKit lighting estimation。但是,支持者没有提到如何启用此功能。

问题:如何在Vuforia开启ARKit的灯光评估?

0 个答案:

没有答案