autoenablesDefaultLighting is too bright in iOS 12 and SCNView.pointOfView is not effective

为君一笑 提交于 2020-01-15 20:12:50

问题


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!

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.

Exemple:
3D object displayed before iOS 12
3D object displayed in iOS 12

It will be good if anyone can help me on it.

Many thanks!

Edit to solve this issue

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.

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;

Thanks


回答1:


You can try enabling HDR. It should result in a balanced exposure

scnView?.pointOfView?.camera?.wantsHDR = true

With HDR enabled, you can even control exposure compensation with

scnView?.pointOfView?.camera?.exposureOffset




回答2:


.camera?.wantsHDR = true

.camera?.wantsExposureAdaptation = false

Should solve the problem!



来源:https://stackoverflow.com/questions/52542734/autoenablesdefaultlighting-is-too-bright-in-ios-12-and-scnview-pointofview-is-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!