OGeek|极客世界-中国程序员成长平台

标题: ios - 在 ARKit 框架中设置光照 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:03
标题: ios - 在 ARKit 框架中设置光照

好的,我是 SceneKitARKit 的新手,我只想设置我添加到场景中的任何模型以获得特定的明亮照明。我已经尝试了使用 ARSceneView 自动更新照明设置的所有不同配置,但唯一真正产生明显差异的是 autoenablesDefaultLighting:

func setup() {

    antialiasingMode = .multisampling4X
    //autoenablesDefaultLighting = true
    preferredFramesPerSecond = 60
    contentScaleFactor = 1.3

    if let camera = pointOfView?.camera {
        camera.wantsHDR = true
        camera.wantsExposureAdaptation = true
        camera.exposureOffset = -1
        camera.minimumExposure = -1
        camera.maximumExposure = 3
    }
}

不管从相机获得的照明(我知道 ArKit 能够做到),我只想始终设置 1 个照明设置。我希望我的场景内容像这样被点亮:

enter image description here

这可能吗?为了达到这种效果,我将设置 sceneView.scene.lightingEnvironment 等于什么?



Best Answer-推荐答案


根据文档,您应该能够在某个位置创建一个 SCNNode,然后向其添加一个 SCNLight:

https://developer.apple.com/documentation/scenekit/scnnode https://developer.apple.com/documentation/scenekit/scnlight

关于ios - 在 ARKit 框架中设置光照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46877727/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4