docs/android/dokka/filament-android/com.google.android.filament/-indirect-light/index.md
//filament-android/com.google.android.filament/IndirectLight
open class IndirectLight
IndirectLight is used to simulate environment lighting, a form of global illumination.
Environment lighting has a two components:
Environments are usually captured as high-resolution HDR equirectangular images and processed by the cmgen tool to generate the data needed by IndirectLight.
Currently IndirectLight is intended to be used for "distant probes", that is, to represent global illumination from a distant (i.e. at infinity) environment, such as the sky or distant mountains. Only a single IndirectLight can be used in a Scene. This limitation will be lifted in the future.
An IndirectLight object is created using the IndirectLight.Builder and destroyed by calling destroyIndirectLight.
Engine engine = Engine.create();
Scene scene = engine.createScene();
IndirectLight environment = new IndirectLight.Builder()
.reflections(cubemap)
.irradiance(numBands, sphericalHarmonicsCoefficients)
.build(engine);
scene.setIndirectLight(environment);
The irradiance represents the light that comes from the environment and shines an object's surface. The irradiance is calculated automatically from the Reflections (see below), and generally doesn't need to be provided explicitly. However, it can be provided separately from the Reflections as Spherical Harmonics (SH) of 1, 2 or 3 bands, respectively 1, 4 or 9 coefficients.
Use the cmgen tool to generate the Spherical Harmonics for a given environment.
The reflections on object surfaces (specular component) is calculated from a specially filtered cubemap pyramid generated by the cmgen tool.
| Scene |
| LightManager |
| Texture |
| Skybox |
| IndirectLight | [main] |
| constructor(indirectLight: Long) |
| Name | Summary |
|---|---|
| Builder | [main] |
| open class Builder | |
Use Builder to construct an IndirectLight object instance. |
| Name | Summary |
|---|---|
| getColorEstimate | [main] |
| open fun | |
| [main] | |
| open fun getColorEstimate(colorIntensity: Array<Float>, sh: Array<Float>, x: Float, y: Float, z: Float): Array<Float> | |
| Helper to estimate the color and relative intensity of the environment in a given direction. | |
| getDirectionEstimate | [main] |
| open fun | |
| [main] | |
| open fun getDirectionEstimate(sh: Array<Float>, direction: Array<Float>): Array<Float> | |
| Helper to estimate the direction of the dominant light in the environment. | |
| getIntensity | [main] |
| open fun getIntensity(): Float | |
| Returns the environment's intensity in lux, or lumen/m^2. | |
| getIrradianceTexture | [main] |
| open fun getIrradianceTexture(): Texture | |
| getNativeObject | [main] |
| open fun getNativeObject(): Long | |
| getReflectionsTexture | [main] |
| open fun getReflectionsTexture(): Texture | |
| getRotation | [main] |
| open fun getRotation(rotation: Array<Float>): Array<Float> | |
| Returns the rigid-body transformation applied to the IBL. | |
| setIntensity | [main] |
| open fun setIntensity(intensity: Float) | |
| Sets the environment's intensity. | |
| setRotation | [main] |
| open fun setRotation(rotation: Array<Float>) | |
| Sets the rigid-body transformation to apply to the IBL. |