1

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

A.Ozda
  • 39
  • 9

2 Answers2

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

Hemant
  • 114
  • 2
  • Thanks for your answer i try this and it work !!! but i have now a grey background even if i set : `self.scnView.backgroundColor = [UIColor whiteColor];` – A.Ozda Sep 28 '18 at 13:49
  • 1
    Not sure why you are getting a grey background. I hope you haven't added any light source of your own, because that could disable the default lighting. "If you change the value to true, SceneKit automatically adds and places an omnidirectional light source when rendering scenes that contain no lights or only contain ambient lights." https://developer.apple.com/documentation/scenekit/scnscenerenderer/1523812-autoenablesdefaultlighting As a workaround, you can also try using clear color and adding a white view behind the scnView. – Hemant Oct 01 '18 at 04:07
1

.camera?.wantsHDR = true

.camera?.wantsExposureAdaptation = false

Should solve the problem!