17

I'm providing screenshot functionality for my AR app, and I noticed that the screenshots I take (via sceneView.snapshot()) are much darker than what I see from the camera. I'm using the ARKit example code from Apple, and it seems like this is affecting it:

camera.wantsHDR = true
camera.wantsExposureAdaptation = true
camera.exposureOffset = -1
camera.minimumExposure = -1
camera.maximumExposure = 3

When I remove the exposure settings, the snapshot works fine. Any way to make sure the snapshot considers those exposure settings?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
pushmatrix
  • 726
  • 1
  • 9
  • 23
  • im not 100% sure about this (as i have done very little with ARKit) but i think there is a variable `sceneView.automaticallyUpdatesLighting = true` try that and see if it helps – E. Huckabee Oct 10 '17 at 05:54
  • Have you already read this article? It also explains the lighting of the sceneView https://blog.markdaws.net/arkit-by-example-part-4-realism-lighting-pbr-b9a0bedb013e – StuiterSlurf Oct 10 '17 at 13:03

1 Answers1

1

UPDATED: November 25, 2019.

#First Reason

The main reason that snapshots taken in AR apps are darker than a video stream coming from a rear RGB camera is because you have two absolutely different scenes: the first one is SCNScene with 3D models having its own exposure and the second one is a RGB camera's view with its own exposure. In ARSCNView these exposures are added together forming an average exposure value, what can be darker (like in your case) or can be lighter.

#Second Reason

Also, you need to take into account a whitePoint instance property also known as a luminance level for use as the upper end of a tone mapping curve.

var whitePoint: CGFloat { get set }

When using a High Dynamic Range (HDR) camera, SceneKit applies a process called tone mapping to translate the wide range of luminance values in the visible scene to the narrower range of brightness values that can be shown on a display. SceneKit determines a tone mapping curve from the minimumExposure, maximumExposure, exposureOffset, and whitePoint properties, along with a measure of scene luminance.

The default value of whitePoint is 1.0. By setting this property to a higher or lower value, you can produce more gradual or more abrupt transitions between shadows and highlights. This property has no effect if the wantsHDR value is false.

camera.whitePoint = 1.5

#Third Reason

Color models of RGB camera stream, rendered SCNView and an iPhone's display are slightly different in Gamma Correction.

Marcus Adams
  • 53,009
  • 9
  • 91
  • 143
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220