Sceneekit–加载HDR或EXR照明环境无效
我尝试加载 .hdr
文件将其用作Skybox并使用其照明信息。这是我使用的代码:
backgroundColor = UIColor.gray
// check if a default skybox is added
let environment = UIImage(named: "studio_small_09_2k.hdr")
scene?.lightingEnvironment.contents = environment
scene?.lightingEnvironment.intensity = 1.0
scene?.background.contents = environment
不幸的是,我收到一个灰色屏幕,也没有错误。有没有在Scenekit中使用HDR文件的经验?
XCode版本:13.2.1 iOS版本:15.3.1 hdr文件: https://polyhaven.com/a/studio_small_09
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常使用,其中6张图像中的每一个为Square
(height == width)
。另外,支持以下立方体映射表示:
(高度== 6 *宽度)
(6 * height == width)
(2 * height ==宽度)
这是SwiftUI代码:
特别注意 - 您需要
。基于
照明模型以获得HDR或EXR反射。让我们为BG设置它:
.exr
不起作用?解决方案很简单:从项目中删除您的
.exr
,然后清空垃圾,然后拖放.exr
file,in选择用于添加这些文件的选项
窗口选择添加到目标
:现在您的
.exr
必须工作。I usually use a Cube Texture Set, where each of 6 images is square
(height == width)
.Also, the following cube map representations are supported:
(height == 6 * width)
(6 * height == width)
(2 * height == width)
Here's a SwiftUI code:
Pay particular attention – you need
.physicallyBased
lighting model to get HDR or EXR reflections.And let's set it for BG:
Why your
.exr
doesn't work?The solutions is simple: delete your
.exr
from project, empty the Trash and after that drag-and-drop.exr
file, inChoose options for adding these files
window chooseAdd to targets
:Now your
.exr
must work.