Environmental Light prefab

Provides environmental light estimation to supporting shaders.

Uses camera sensor data to estimate environmental lighting conditions. This prefab automatically adjusts lighting settings in your scene to be aligned with those estimated by ARCore.

Ambient Intensity Light Estimation is accessible to shaders via the _GlobalLightEstimation global shader property. To use it, a custom shader is required. This includes the following shaders provided by the SDK:

  1. ARCore/DiffuseWithLightEstimation
  2. ARCore/SpecularWithLightEstimation

The _GlobalLightEstimation property is used to adjust the shader's final color, for consistency with the camera passthrough image.

Environmental HDR Light Estimation works with built-in Unity shaders, such as the mobile shader and standard shader. For Environmental HDR (with or without reflections) Light Estimation, this prefab adjusts the following items:

  1. Directional Light rotation and color.
  2. Ambient Probe.
  3. Reflection Cubemap.

Prefab Hierarchy

Game object name Description

Holds the EnvironmentalLight component that updates the light estimation based on the LightEstimationMode.

Provides directional light estimation when the current light estimation state is LightEstimateState.Valid and the light estimation mode is LightEstimationMode.EnvironmentalHDRWithReflections or LightEstimationMode.EnvironmentalHDRWithoutReflections.

Environmental Light game object

Holds the EnvironmentalLight component that updates the light estimation based on the LightEstimationMode.

For the LightEstimationMode.AmbientIntensity light estimation mode, it will update _GlobalColorCorrection and _GlobalLightEstimation shader properties during Update(). For the light estimation modes LightEstimationMode.EnvironmentalHDRWithReflections and LightEstimationMode.EnvironmentalHDRWithoutReflections, it will update Directional Light and RenderSettings during Update().

This property will be updated only while the current light estimation state is LightEstimateState.Valid.

When this script is missing or disabled, materials that use Amibent Intensity Light Estimation shader will use the last set light estimation value that was set. If the value was never set, materials that use Ambient Intensity Light Estimation shader will render entirely black surfaces, because _GlobalLightEstimation will be initialized to 0 at startup.

Components: GoogleARCore.EnvironmentalLight, UnityEngine.Transform

Directional light game object

Provides directional light estimation when the current light estimation state is LightEstimateState.Valid and the light estimation mode is LightEstimationMode.EnvironmentalHDRWithReflections or LightEstimationMode.EnvironmentalHDRWithoutReflections.

This property will be enabled when the light estimation is one of the Environmental HDR modes, otherwise, it will remain the same state.

Components: UnityEngine.Light, UnityEngine.Transform