Light

fun FilamentSceneScope.Light(type: LightManager.Type, color: Color = Color(1f, 1f, 1f), intensity: Float, intensityUnit: LightUnit = LightUnit.LUMINOUS_POWER, efficiency: Float = 1.0f, castShadows: Boolean = false, direction: Direction = Direction(0.3f, -1f, -0.5f), position: Position = Position(0f, 2f, 0f), falloff: Float = 10.0f, cone: SpotCone = SpotCone(), sun: SunParams = SunParams(), lightChannels: Set<Int> = setOf(0))

Adds a light to the scene. type is Filament's own LightManager.Type enum.

Set only the parameters relevant to your light type — irrelevant ones are ignored by Filament's builder. Type-specific groups (cone, sun) use sensible defaults.

Example:

Light(
type = LightManager.Type.SUN,
direction = Direction(0.3f, -1f, -0.5f),
intensity = 110_000f,
sun = SunParams(angularRadius = 2.4f),
castShadows = true,
)

// A physically-correct focused spot whose wattage is given as a 12 W LED bulb,
// affecting only objects on light channels 0 and 2.
Light(
type = LightManager.Type.FOCUSED_SPOT,
position = Position(2f, 3f, 0f),
direction = Direction(0f, -1f, 0f),
intensity = 12f,
intensityUnit = LightUnit.WATTS,
efficiency = 0.087f,
cone = SpotCone(innerAngle = 0.3f, outerAngle = 0.5f),
lightChannels = setOf(0, 2),
)

Parameters

intensity

Brightness in the units selected by intensityUnit. For LightUnit.WATTS this is the electrical wattage and is scaled by efficiency.

intensityUnit

How intensity is interpreted. See LightUnit.

efficiency

Luminous efficiency fraction, only used when intensityUnit is LightUnit.WATTS.

lightChannels

Which light channels (0–7) this light affects. A renderable is only lit if it shares at least one enabled channel with the light. Channel 0 is the default for both.