Back to Filament

getDirectionEstimate

docs/android/dokka/filament-android/com.google.android.filament/-indirect-light/get-direction-estimate.md

1.75.02.4 KB
Original Source

//filament-android/com.google.android.filament/IndirectLight/getDirectionEstimate

getDirectionEstimate

[main]
open fun getDirectionEstimate(sh: Array<Float>, direction: Array<Float>): Array<Float>

Helper to estimate the direction of the dominant light in the environment.

This assumes that there is only a single dominant light (such as the sun in outdoors environments), if it's not the case the direction returned will be an average of the various lights based on their intensity.

If there are no clear dominant light, as is often the case with low dynamic range (LDR) environments, this method may return a wrong or unexpected direction.

The dominant light direction can be used to set a directional light's direction, for instance to produce shadows that match the environment.

Return

the direction paramter if it was provided, or a newly allocated float array containing a unit vector representing the direction of the dominant light

Parameters

main

shpre-scaled 3-bands spherical harmonics
directionan array of 3 floats to receive a unit vector representing the direction of the dominant light or null

See also

LightManager.Builder
getColorEstimate

[main]
open fun getDirectionEstimate(direction: Array<Float>): Array<Float>


Deprecated


Deprecated