ArLightEstimate
Holds information about the estimated lighting of the real scene.
Summary
Enumerations |
|
---|---|
ArLightEstimateState{
|
enum Tracks the validity of an ArLightEstimate object. |
Typedefs |
|
---|---|
ArLightEstimate
|
typedefstruct ArLightEstimate_
An estimate of the real-world lighting (value type). |
Functions |
|
---|---|
ArLightEstimate_acquireEnvironmentalHdrCubemap(const ArSession *session, const ArLightEstimate *light_estimate, ArImageCubemap out_textures_6)
|
void
Gets the 6 cubemap textures in OpenGL texture format based on the inferred Environmental HDR lighting.
|
ArLightEstimate_create(const ArSession *session, ArLightEstimate **out_light_estimate)
|
void
Allocates an
ArLightEstimate object. |
ArLightEstimate_destroy(ArLightEstimate *light_estimate)
|
void
Releases the provided
ArLightEstimate object. |
ArLightEstimate_getColorCorrection(const ArSession *session, const ArLightEstimate *light_estimate, float *out_color_correction_4)
|
void
Gets the color correction values that are uploaded to the fragment shader.
|
ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics(const ArSession *session, const ArLightEstimate *light_estimate, float *out_coefficients_27)
|
void
Gets the spherical harmonics coefficients for the ambient illumination based on the inferred Environmental HDR Lighting Estimation.
|
ArLightEstimate_getEnvironmentalHdrMainLightDirection(const ArSession *session, const ArLightEstimate *light_estimate, float *out_direction_3)
|
void
Returns the direction of the main directional light based on the inferred Environmental HDR Lighting Estimation.
|
ArLightEstimate_getEnvironmentalHdrMainLightIntensity(const ArSession *session, const ArLightEstimate *light_estimate, float *out_intensity_3)
|
void
Returns the intensity of the main directional light based on the inferred Environmental HDR Lighting Estimation.
|
ArLightEstimate_getPixelIntensity(const ArSession *session, const ArLightEstimate *light_estimate, float *out_pixel_intensity)
|
void
Retrieves the pixel intensity, in gamma color space, of the current camera view.
|
ArLightEstimate_getState(const ArSession *session, const ArLightEstimate *light_estimate, ArLightEstimateState *out_light_estimate_state)
|
void
Retrieves the validity state of an
ArLightEstimate . |
ArLightEstimate_getTimestamp(const ArSession *session, const ArLightEstimate *light_estimate, int64_t *out_timestamp_ns)
|
void
Returns the timestamp of the given
ArLightEstimate in nanoseconds. |
Enumerations
ArLightEstimateState
ArLightEstimateState
Tracks the validity of an ArLightEstimate
object.
Properties | |
---|---|
AR_LIGHT_ESTIMATE_STATE_NOT_VALID
|
The |
AR_LIGHT_ESTIMATE_STATE_VALID
|
The |
Typedefs
ArLightEstimate
struct ArLightEstimate_ ArLightEstimate
An estimate of the real-world lighting (value type).
- Create with:
ArLightEstimate_create
- Allocate with:
ArFrame_getLightEstimate
- Release with:
ArLightEstimate_destroy
Functions
ArLightEstimate_acquireEnvironmentalHdrCubemap
void ArLightEstimate_acquireEnvironmentalHdrCubemap( const ArSession *session, const ArLightEstimate *light_estimate, ArImageCubemap out_textures_6 )
Gets the 6 cubemap textures in OpenGL texture format based on the inferred Environmental HDR lighting.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ArLightEstimate_create
void ArLightEstimate_create( const ArSession *session, ArLightEstimate **out_light_estimate )
Allocates an ArLightEstimate
object.
ArLightEstimate_destroy
void ArLightEstimate_destroy( ArLightEstimate *light_estimate )
Releases the provided ArLightEstimate
object.
ArLightEstimate_getColorCorrection
void ArLightEstimate_getColorCorrection( const ArSession *session, const ArLightEstimate *light_estimate, float *out_color_correction_4 )
Gets the color correction values that are uploaded to the fragment shader.
Use the RGB scale factors (components 0-2) to match the color of the light in the scene. Use the pixel intensity (component 3) to match the intensity of the light in the scene. If AR_LIGHT_ESTIMATION_MODE_AMBIENT_INTENSITY
mode is not set, returns all zeros.
out_color_correction_4
components are:
[0]
Red channel scale factor. This value is larger or equal to zero.[1]
Green channel scale factor. This value is always 1.0 as the green channel is the reference baseline.[2]
Blue channel scale factor. This value is larger or equal to zero.[3]
Pixel intensity. This is the same value as the one return fromArLightEstimate_getPixelIntensity
.
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. Then multiply component-wise against the final calculated color after rendering.
ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics
void ArLightEstimate_getEnvironmentalHdrAmbientSphericalHarmonics( const ArSession *session, const ArLightEstimate *light_estimate, float *out_coefficients_27 )
Gets the spherical harmonics coefficients for the ambient illumination based on the inferred Environmental HDR Lighting Estimation.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ArLightEstimate_getEnvironmentalHdrMainLightDirection
void ArLightEstimate_getEnvironmentalHdrMainLightDirection( const ArSession *session, const ArLightEstimate *light_estimate, float *out_direction_3 )
Returns the direction of the main directional light based on the inferred Environmental HDR Lighting Estimation.
If AR_LIGHT_ESTIMATION_MODE_ENVIRONMENTAL_HDR
mode is not set, returns [0.0, 1.0, 0.0], representing a light shining straight down from above.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ArLightEstimate_getEnvironmentalHdrMainLightIntensity
void ArLightEstimate_getEnvironmentalHdrMainLightIntensity( const ArSession *session, const ArLightEstimate *light_estimate, float *out_intensity_3 )
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 AR_LIGHT_ESTIMATION_MODE_ENVIRONMENTAL_HDR
mode is not set, returns zero for all elements of the array.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ArLightEstimate_getPixelIntensity
void ArLightEstimate_getPixelIntensity( const ArSession *session, const ArLightEstimate *light_estimate, float *out_pixel_intensity )
Retrieves the pixel intensity, in gamma color space, of the current camera view.
Values are in the range [0.0, 1.0], with zero being black and one being white. If AR_LIGHT_ESTIMATION_MODE_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.
ArLightEstimate_getState
void ArLightEstimate_getState( const ArSession *session, const ArLightEstimate *light_estimate, ArLightEstimateState *out_light_estimate_state )
Retrieves the validity state of an ArLightEstimate
.
If the resulting value of *out_light_estimate_state
is not AR_LIGHT_ESTIMATE_STATE_VALID
, the estimate should not be used for rendering.
ArLightEstimate_getTimestamp
void ArLightEstimate_getTimestamp( const ArSession *session, const ArLightEstimate *light_estimate, int64_t *out_timestamp_ns )
Returns the timestamp of the given ArLightEstimate
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 ArFrame_getTimestamp
.