PointLightComponent
A Component that emits omnidirectional light from the entity's position.
This component creates a light source that radiates equally in all directions (like a light bulb), with configurable properties for realistic lighting scenarios.
Key properties:
Position-based: Light originates from the entity's world position.
Distance Attenuation: Light intensity falls off with distance based on attenuationRadius.
Color & Intensity: Fully customizable light appearance with color and intensity.
No Shadow Casting: Optimized for performance (see notes below).
To receive lighting effects, the Entity must use a Material that supports lighting. For example, PhysicallyBasedMaterial respond to lighting, while UnlitMaterial does not.
Code sample:
val bulbEntity = Entity().apply {
components.set(TransformComponent().apply { setPosition(Vector3(0f, 2f, 0f)) })
components.set(PointLightComponent(
color = Color4(1f, 0.9f, 0.8f, 1f),
intensity = 1500f, // Measured in lumens
attenuationRadius = 2f // Measured in meters
))
}Performance notes:
Multiple point lights impact rendering performance.
Larger attenuationRadius values increase shaded area complexity.
Consider using SpotLightComponent or DirectionalLightComponent for needs of shadows.
Related components:
DirectionalLightComponent - For sunlight-style parallel lighting.
SpotLightComponent - For directional cone lighting.