菜鸟教程小白 发表于 2022-12-11 19:03:45

ios - 在 ARKit 框架中设置光照


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

<pre><code>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
    }
}
</code></pre>

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

<p> <a href="/image/upRTW.jpg" rel="noreferrer noopener nofollow"><img src="/image/upRTW.jpg" alt="enter image description here"/></a> </p>

<p>这可能吗?为了达到这种效果,我将设置 <code>sceneView.scene.lightingEnvironment</code> 等于什么? </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>根据文档,您应该能够在某个位置创建一个 SCNNode,然后向其添加一个 SCNLight:</p>

<p> <a href="https://developer.apple.com/documentation/scenekit/scnnode" rel="noreferrer noopener nofollow">https://developer.apple.com/documentation/scenekit/scnnode</a>
<a href="https://developer.apple.com/documentation/scenekit/scnlight" rel="noreferrer noopener nofollow">https://developer.apple.com/documentation/scenekit/scnlight</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 在 ARKit 框架中设置光照,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/46877727/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/46877727/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 在 ARKit 框架中设置光照