Class ARLightEstimate

java.lang.Object
com.codename1.ar.ARLightEstimate

public final class ARLightEstimate extends Object

An estimate of the real-world lighting around the device, used to shade virtual content so it blends with the camera image. Poll it through ARSession#getLightEstimate(); light changes every frame, so no events are fired for it.

The ambient intensity is normalized so 1.0 means neutral indoor lighting: platform backends map their native scale to this convention (ARKit reports about 1000 lumens in a neutral room, ARCore reports a mean pixel intensity of about 0.18 - both map to 1.0). Values below 1.0 mean the scene is darker than neutral, values above mean brighter.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ARLightEstimate
    An invalid estimate with neutral values, returned before the platform produces its first real estimate.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ARLightEstimate(boolean valid, float ambientIntensity, float colorR, float colorG, float colorB)
    Creates a light estimate.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    The normalized ambient light intensity.
    float[]
    The per-channel color correction as a newly allocated {r, g, b} array of scale factors.
    boolean
    True when the platform produced a real estimate; false for the placeholder returned before tracking starts.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • INVALID

      public static final ARLightEstimate INVALID
      An invalid estimate with neutral values, returned before the platform produces its first real estimate.
  • Constructor Details

    • ARLightEstimate

      public ARLightEstimate(boolean valid, float ambientIntensity, float colorR, float colorG, float colorB)

      Creates a light estimate. Intended for platform implementations and tests; applications receive estimates from the session.

      Parameters
      • valid: whether the platform produced a real estimate

      • ambientIntensity: normalized intensity, 1.0 is neutral

      • colorR, colorG, colorB: per-channel color correction scale factors, 1.0 each is neutral white light

  • Method Details

    • isValid

      public boolean isValid()
      True when the platform produced a real estimate; false for the placeholder returned before tracking starts.
    • getAmbientIntensity

      public float getAmbientIntensity()
      The normalized ambient light intensity. 1.0 is neutral indoor lighting, lower is darker, higher is brighter.
    • getColorCorrection

      public float[] getColorCorrection()
      The per-channel color correction as a newly allocated {r, g, b} array of scale factors. {1, 1, 1} is neutral white light; multiply your content's color by these factors to match the scene's color cast.