ImageBasedLightComponent class Lighting and environment

The image-based lighting a loaded model declares through EXT_lights_image_based, surfaced so an application can build an EnvironmentMap from it.

The importer attaches this to the root of a model whose default scene references such a light. Nothing is applied automatically: reading it and deciding whether the model's environment should light the whole scene is the application's call.

final ibl = ImageBasedLightComponent.of(model);
if (ibl != null) {
  scene.environment = await EnvironmentMap.fromKtx2Bytes(
    myCubemapBytes,
    diffuseSphericalHarmonics: ibl.diffuseSphericalHarmonics,
  );
  scene.environmentIntensity = ibl.intensity;
}

TODO(ibl-gltf-auto-apply): wire this into Scene.environment on import, behind an opt-in, once the specular chain can be assembled straight into a radiance cube (the extension ships one 2D image per face per roughness level, which needs an upload path that stitches them).

Inheritance

Properties

diffuseSphericalHarmonics List<Vector3>?
irradianceCoefficients brought onto the engine's diffuse contract: the Lambertian A_l band factors and the 1/pi BRDF term folded in, ready for EnvironmentMap.fromKtx2Bytes or EnvironmentMap.fromGpuTextures.
no setter
enabled bool
Whether this component's update hook runs each frame.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
intensity double
Scalar multiplier the source declares, suitable for Scene.environmentIntensity.
final
irradianceCoefficients List<Vector3>
The extension's 9 RGB irradiance coefficients exactly as stored, or empty when the source omitted them.
final
isAttached bool
Whether this component is currently attached to a node.
no setterinherited
isLoaded bool
Whether onLoad has completed.
no setterinherited
isMounted bool
Whether the owning node is part of a live scene graph.
no setterinherited
name String?
The light's name in the source document, or null.
final
node Node
The node this component is attached to.
no setterinherited
rotation → Quaternion
Rotation the source declares for the cubemap relative to the scene. Feed it to Scene.environmentTransform to honor it.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
specularImages List<List<Uint8List>>
specularImages[level][face] encoded image bytes, faces in cube order (+X, -X, +Y, -Y, +Z, -Z), level 0 the mirror level. Empty when the importer could not source them.
final
specularImageSize int
Face size of the specular chain's mip 0.
final

Methods

cloneFor(Node cloneOwner) Component?
Returns a copy of this component for cloneOwner, the Node.clone counterpart of the owning node, or null to not carry the component to clones (the default).
inherited
fixedUpdate(double fixedDt) → void
Called once per fixed physics step while the component is mounted, enabled, and loaded. fixedDt is the fixed timestep of the surrounding PhysicsWorld, not the frame interval.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAttach() → void
Called when this component is added to a node.
inherited
onDetach() → void
Called when this component is removed from a node.
inherited
onLoad() Future<void>
Optional asynchronous setup, such as loading an asset.
inherited
onMount() → void
Called when the owning node enters a live scene graph.
inherited
onUnmount() → void
Called when the owning node leaves a live scene graph.
inherited
toString() String
A string representation of this object.
inherited
update(double deltaSeconds) → void
Called once per frame while the component is mounted, enabled, and loaded. deltaSeconds is the elapsed time since the previous tick. A traversal visits each component at most once. Removing this component or an earlier sibling is safe. A component inserted before the current traversal position starts on the next frame. Reordering component or child lists during traversal is unsupported.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

of(Node root) ImageBasedLightComponent?
The first image-based light on root or its subtree, breadth-first, or null when the model declared none.