热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

iOS10:Omni类型的SCNLight忽略衰减值?-iOS10:SCNLightoftypeOmniignoringattenuationvalues?

IhaveasimpleSceneKitscenewithonlytwolightsources(ambientandomni)andonemodel.Ihave

I have a simple SceneKit scene with only two light sources (ambient and omni) and one model. I have noticed that my scene appears totally dark when running on iOS 10 (even before I recompiled my app with the iOS 10 SDK). After investigating I realized that my ambient light was the only one affecting my model.

我有一个简单的SceneKit场景,只有两个光源(环境和全向)和一个模型。我注意到在iOS 10上运行时我的场景显得很暗(甚至在我使用iOS 10 SDK重新编译我的应用程序之前)。经过调查,我意识到我的环境光是影响我模型的唯一一个。

The only way to make my omni light affect my model was to bring it really close to it, or to increase its intensity (using the new setIntensity: selector) by a factor of 5000000.

使我的全向光影响我的模型的唯一方法是使它非常接近它,或者将其强度(使用新的setIntensity:selector)增加5000000倍。

Changing the values of attenuationStartDistance, attenuationEndDistance, and attenuationFalloffExponent didn't change the result, which is really odd, considering that if I use 0.0 for both distances then I shouldn't expect any attenuation, and yet it happened (hence the need to use this huge intensity value).

更改attenuationStartDistance,attenuationEndDistance和attenuationFalloffExponent的值并没有改变结果,这真的很奇怪,考虑到如果我对两个距离使用0.0,那么我不应该期望任何衰减,但它发生了(因此需要使用这个巨大的强度值)。

This result doesn't change even if I add the SCNDisableLinearSpaceRendering key to my Info.plist or the SCNDisableWideGamut key.

即使我将SCNDisableLinearSpaceRendering键添加到我的Info.plist或SCNDisableWideGamut键,此结果也不会更改。

Am I missing some new parameter or is it an iOS 10 bug?

我错过了一些新参数还是iOS 10错误?

1 个解决方案

#1


2  

I have managed to change the result after changing the values of attenuationStartDistance, attenuationEndDistance, and attenuationFalloffExponent, but only when using that huge intensity value. iOS 10 is definitely not ignoring these parameters.

我已经设法在更改attenuationStartDistance,attenuationEndDistance和attenuationFalloffExponent的值后更改结果,但仅在使用该巨大强度值时。 iOS 10绝对不会忽略这些参数。

However, it seems that iOS 10 is applying yet another attenuation on top the previous one. It is also attenuating the intensity value automatically, regardless of those parameters. Perhaps it's treating this new intensity parameter as if in a physically based renderer, even when it's not?

然而,似乎iOS 10正在应用另一个衰减在前一个上面。无论这些参数如何,它也会自动衰减强度值。也许它正在将这个新的强度参数视为基于物理的渲染器,即使它不是?

So, if you have a distant omni light source, it seems that you'll still need a big intensity for it to be bright enough from a distance, even if you disable the attenuation.

所以,如果你有一个遥远的全向光源,你似乎仍需要一个很大的强度,即使你禁用了衰减,它也能从远处获得足够的亮度。

EDIT

编辑

iOS 10 is indeed using a physically based lighting model as the new default! After loading a model, iOS 9 will have SCNLightingModelBlinn for the lightingModelName property of the material whereas iOS 10 will have SCNLightingModelPhysicallyBased. You can achieve iOS 9 behavior by changing the value of that property after loading your model.

iOS 10确实使用基于物理的照明模型作为新的默认值!加载模型后,iOS 9将为材质的lightingModelName属性提供SCNLightingModelBlinn,而iOS 10将具有SCNLightingModelPhysicallyBased。通过在加载模型后更改该属性的值,可以实现iOS 9的行为。

for(SCNMaterial * mt in model.geometry.materials)
    mt.lightingModelName = SCNLightingModelBlinn;

推荐阅读
author-avatar
一代天骄的小男人_580
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有