IndirectLight

class IndirectLight(nativeHandle: NativePointer)

IndirectLight simulates environment lighting, a form of global illumination.

Environment lighting provides two components:

  • Irradiance: Diffuse lighting from the environment (brightness contribution from all directions)

  • Reflections: Specular component (mirror-like reflections from the environment on shiny surfaces)

Environments are typically captured as high-resolution HDR equirectangular images and processed by the cmgen tool to generate the data needed by IndirectLight.

Creation and destruction: Create an IndirectLight using the Builder and assign it to the Scene via Scene.setIndirectLight(). Destroy with Engine.destroy(). Only one IndirectLight can be active in a Scene at a time.

Irradiance: The irradiance represents light coming from the environment. It is calculated automatically from the reflections cubemap, but can be provided separately as spherical harmonics (SH) coefficients for memory efficiency.

Spherical harmonics: Irradiance and radiance can be specified as SH coefficients. Use 1, 2, or 3 bands for 1, 4, or 9 coefficients respectively. The cmgen tool generates pre-scaled SH coefficients that are ready to use.

Reflections: Reflections on object surfaces are calculated from a specially filtered cubemap pyramid generated by the cmgen tool. Each mipmap level encodes irradiance for a different roughness level.

See also

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard
class Builder

Builder for creating IndirectLight instances.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Gets/sets the environment's overall intensity multiplier.

Link copied to clipboard

Gets the irradiance cubemap texture (if set).

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Gets the reflections cubemap texture (if set).

Link copied to clipboard

Gets/sets the environment rotation as a 3x3 matrix.

Functions

Link copied to clipboard
fun getColorEstimate(x: Float, y: Float, z: Float, out: FloatArray? = null): FloatArray

Helper to estimate the color and relative intensity of the environment in a given direction.

Link copied to clipboard

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