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

1.1k views Asked by At

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

2

There are 2 answers

2
Hemant On BEST ANSWER

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

0
Marcus Dobler On

.camera?.wantsHDR = true

.camera?.wantsExposureAdaptation = false

Should solve the problem!