public class
LightEstimate
Holds information about the estimated lighting of the real scene. Returned by Frame.getLightEstimate()
Nested Classes
enum
|
LightEstimate.State |
Light Estimate States. |
Public Methods
Image[]
|
acquireEnvironmentalHdrCubeMap()
Gets the 6 cubemap textures in OpenGL texture format based on the inferred Environmental HDR
lighting.
|
void
|
getColorCorrection(float[] outColorCorrection4, int offset)
Returns RGB scaling factors to be applied to the final color computed in the fragment shader.
|
float[]
|
getEnvironmentalHdrAmbientSphericalHarmonics()
Gets the spherical harmonics coefficients for the ambient illumination based on the inferred
Environmental HDR lighting.
|
float[]
|
getEnvironmentalHdrMainLightDirection()
Returns the direction of the main directional light based on the inferred Environmental HDR
light estimation.
|
float[]
|
getEnvironmentalHdrMainLightIntensity()
Returns the intensity of the main directional light based on the inferred Environmental HDR
lighting estimation.
|
float
|
getPixelIntensity()
Returns the pixel intensity of the current camera view in gamma color space.
|
LightEstimate.State
|
getState()
Returns the validity of this lighting estimate.
|
long
|
getTimestamp()
Returns the timestamp of the LightEstimate in nanoseconds.
|
Inherited Methods
Public Methods
public Image[] acquireEnvironmentalHdrCubeMap ()
acquireEnvironmentalHdrCubeMap
public Image[] acquireEnvironmentalHdrCubeMap()
Gets the 6 cubemap textures in OpenGL texture format based on the inferred Environmental HDR lighting.
Details | |
---|---|
Returns | An array that contains 6 images in AIMAGE_FORMAT_RGBA_FP16 format for the HDR cubemap. The memory layout for the image
data is identical to GL_RGBA16F . The pixel values are in linear color space. The
order of the images corresponds to the cubemap order in the following fashion:
Config.LightEstimationMode.ENVIRONMENTAL_HDR mode is not set, all textures will
be assigned with zero pixel values. All 6 acquired images must be released with Image.close() once they are no longer needed.
|
public void getColorCorrection (float[] outColorCorrection4, int offset)
getColorCorrection
public void getColorCorrection( float[] outColorCorrection4, int offset )
Returns RGB scaling factors to be applied to the final color computed in the fragment shader.
The last component contains the average pixel intensity. The color correction method uses the
green channel as reference baseline and scales the red and blue channels accordingly. In this
way the overall intensity will not be significantly changed. If Config.LightEstimationMode.AMBIENT_INTENSITY
mode is not set, returns all zeros.
The RGB scale factors can be used independently from the pixel intensity value. They are put together for the convenience of only having to upload one float4 to the fragment shader.
The RGB scale factors are not intended to brighten nor dim the scene. They are only to shift the color of the virtual object towards the color of the light; not intensity of the light. The pixel intensity is used to match the intensity of the light in the scene.
Color correction values are reported in gamma color space. If rendering in gamma color space, multiply them component-wise against the final calculated color after rendering. If rendering in linear space, first convert the values to linear space by rising to the power 2.2.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
public float[] getEnvironmentalHdrAmbientSphericalHarmonics ()
getEnvironmentalHdrAmbientSphericalHarmonics
public float[] getEnvironmentalHdrAmbientSphericalHarmonics()
Gets the spherical harmonics coefficients for the ambient illumination based on the inferred Environmental HDR lighting.
Details | |
---|---|
Returns | The output spherical harmonics coefficients for the ambient illumination. This array
contains 9 sets of per-channel coefficients, or a total of 27 values of 32-bit floating
point type. The coefficients are stored in a channel-major fashion e.g. [r0, g0, b0,
r1, g1, b1, ... , r8, g8, b8] . If Config.LightEstimationMode.ENVIRONMENTAL_HDR
mode is not set, returns zero for all 27 coefficients.
|
public float[] getEnvironmentalHdrMainLightDirection ()
getEnvironmentalHdrMainLightDirection
public float[] getEnvironmentalHdrMainLightDirection()
Returns the direction of the main directional light based on the inferred Environmental HDR
light estimation. If Config.LightEstimationMode.ENVIRONMENTAL_HDR
mode is not set,
returns [0.0, 1.0, 0.0]
, representing a light shining straight down from above.
Details | |
---|---|
Returns | The normalized output lighting direction of the main directional light as 3 floats
[x, y, z] .
|
public float[] getEnvironmentalHdrMainLightIntensity ()
getEnvironmentalHdrMainLightIntensity
public float[] getEnvironmentalHdrMainLightIntensity()
Returns the intensity of the main directional light based on the inferred Environmental HDR
lighting estimation. All return values are larger or equal to zero. If Config.LightEstimationMode.ENVIRONMENTAL_HDR
mode is not set, returns zero for all elements of
the array.
Details | |
---|---|
Returns | The output lighting intensity of the main directional light as 3 floats [r, g, b]. |
public float getPixelIntensity ()
getPixelIntensity
public float getPixelIntensity()
Returns the pixel intensity of the current camera view in gamma color space. Values are in the
range [0.0, 1.0]
, with zero being black and one being white. If Config.LightEstimationMode.AMBIENT_INTENSITY
mode is not set, returns zero.
If rendering in gamma color space, divide this value by 0.466, which is middle gray in gamma color space, and multiply against the final calculated color after rendering. If rendering in linear space, first convert this value to linear space by rising to the power 2.2. Normalize the result by dividing it by 0.18, which is middle gray in linear space. Then multiply by the final calculated color after rendering.
public LightEstimate.State getState ()
getState
public LightEstimate.State getState()
Returns the validity of this lighting estimate. When the estimate is LightEstimate.State.NOT_VALID
it
should not be used for rendering.
public long getTimestamp ()
getTimestamp
public long getTimestamp()
Returns the timestamp of the LightEstimate in nanoseconds.
ARCore returns a different timestamp when the underlying light estimate has changed. Conversely, the same timestamp is returned if the light estimate has not changed.
This timestamp uses the same time base as Frame.getTimestamp()
.