问题描述
我正在使用我的SceneView的SceneKit的autoenablesDefaultLighting
和allowsCameraControl
函数为应用程序中的obj 3D模型提供光照,并在Objective-C中围绕该对象旋转.自升级到iOS12后,默认的autoenablesDefaultLighting
光照强度变得更高,并且3D模型看起来如此明亮!
I am using SceneKit’s autoenablesDefaultLighting
and allowsCameraControl
functions of my sceneView to provide light to an obj 3D model in the app and rotate around this object in Objective-C. Since upgrading to iOS12, the default light intensity of autoenablesDefaultLighting
gets higher and the 3D model looks so bright!
有人遇到过同样的问题吗?如果是,当autoenablesDefaultLighting
的值为是"时,是否可以控制其光强度?如果它不可编辑,我试图通过创建一个节点将全向光或定向光附加/约束到摄像机,为该节点分配一个光并将其添加为SCNView.pointOfView
的子级,但是没有光照亮场景.
Did anyone faced the same issue? If yes, is there a way to control the light intensity of autoenablesDefaultLighting
when its value is ‘YES’? If it is not editable, I tried to attach/constraint an omni light or directional light to a camera by creating a node, assign a light to this node and add as child of SCNView.pointOfView
but no light illuminates the scene.
示例:
在iOS 12之前显示的3D对象
在iOS 12中显示的3D对象
Exemple:
3D object displayed before iOS 12
3D object displayed in iOS 12
如果有人可以帮助我,那会很好.
It will be good if anyone can help me on it.
非常感谢!
编辑以解决此问题
我创建一个新的SCNCamera并将其添加到一个节点中,并设置我的scnView的PointOfView.用scnView.pointOfView.wantHDR = YES;
激活此摄像机的HDR但背景为灰色.
I create a new SCNCamera and add this in a node and set the PointOfView of my scnView. Activate the HDR of this camera with scnView.pointOfView.wantHDR = YES;
but a had a grey background.
要删除灰色背景,请使用scnView.backgroundColor = [UIColor ClearColor]
删除背景色并使用:
To delete the grey background I delete the background color with scnView.backgroundColor = [UIColor ClearColor]
and set the explosure of the camera to -1 with :
self.scnView.pointOfView.camera.minimumExposure = -1;
self.scnView.pointOfView.camera.maximumExposure = -1;
谢谢
推荐答案
您可以尝试启用HDR.它应该导致均衡的曝光
You can try enabling HDR. It should result in a balanced exposure
scnView?.pointOfView?.camera?.wantsHDR = true
启用HDR后,您甚至可以使用
With HDR enabled, you can even control exposure compensation with
scnView?.pointOfView?.camera?.exposureOffset
这篇关于autoenablesDefaultLighting在iOS 12中太亮,SCNView.pointOfView无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!