热门标签 | 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;

推荐阅读
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 本文讨论了在openwrt-17.01版本中,mt7628设备上初始化启动时eth0的mac地址总是随机生成的问题。每次随机生成的eth0的mac地址都会写到/sys/class/net/eth0/address目录下,而openwrt-17.01原版的SDK会根据随机生成的eth0的mac地址再生成eth0.1、eth0.2等,生成后的mac地址会保存在/etc/config/network下。 ... [详细]
  • 本文介绍了brain的意思、读音、翻译、用法、发音、词组、同反义词等内容,以及脑新东方在线英语词典的相关信息。还包括了brain的词汇搭配、形容词和名词的用法,以及与brain相关的短语和词组。此外,还介绍了与brain相关的医学术语和智囊团等相关内容。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 高质量SQL书写的30条建议
    本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了贝叶斯垃圾邮件分类的机器学习代码,代码来源于https://www.cnblogs.com/huangyc/p/10327209.html,并对代码进行了简介。朴素贝叶斯分类器训练函数包括求p(Ci)和基于词汇表的p(w|Ci)。 ... [详细]
  • Python中的PyInputPlus模块原文:https ... [详细]
  • C++ STL复习(13)容器适配器
    STL提供了3种容器适配器,分别为stack栈适配器、queue队列适配器以及priority_queue优先权队列适配器。不同场景下,由于不同的序列式 ... [详细]
  • 移动传感器扫描覆盖摘要:关于传感器网络中的地址覆盖问题,已经做过很多尝试。他们通常归为两类,全覆盖和栅栏覆盖,统称为静态覆盖 ... [详细]
  • GO语言 包 if..else.. for循环 switch 数组
    包1.什么是包1.新建一个文件夹,内部写很多go文件,但是包名必须一致,改文件夹就是一个包2.作用和优点包用于组织Go源代码,提供了更好的可重用性与可读性。由于包提供了代码的封装, ... [详细]
  • Apple iPad:过渡设备还是平板电脑?
    I’vebeenagonizingoverwhethertopostaniPadarticle.Applecertainlydon’tneedmorepublicityandthe ... [详细]
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社区 版权所有