PointLight class Lighting and environment
A light that radiates from a single world-space point equally in every direction, its influence falling off with distance.
Attach one to the scene by adding a PointLightComponent to a node; the
light's world position is the node's world-space translation, so moving
the node moves the light. The analytic contribution is layered on top of
the image-based-lighting ambient term, the same as DirectionalLight.
When castsShadow is true and the scene's point-shadow budget has room, the renderer renders six perspective depth faces around the light into the shared shadow atlas and the light is occluded by geometry between it and the surface.
Constructors
- PointLight({Vector3? color, double intensity = 1.0, double range = 0.0, double falloffExponent = 2.0, double radius = 0.0, bool castsShadow = false, int shadowMapResolution = 512, double shadowNear = 0.1, double shadowDepthBias = 0.0, double shadowNormalBias = 0.1, double shadowSoftness = 1.0, ShadowCasterFaces shadowCasterFaces = ShadowCasterFaces.front, int channelMask = 0xFF, int shadowCasterChannelMask = 0xFF})
- Creates a PointLight.
Properties
- castsShadow ↔ bool
-
Whether this light casts a shadow. When true, the renderer renders six
perspective depth faces around the light if the scene's point-shadow
budget has room (shadow-casting point lights are limited; the rest
shade unshadowed). Six faces cost six depth passes, so this is the most
expensive shadow type per light.
getter/setter pair
- channelMask ↔ int Lighting and environment
-
The light channels this light illuminates, an 8-bit mask (default
0xFF, every channel). A node receives this light only whenchannelMask & node.lightChannelMaskis nonzero, so a zero mask on either side never intersects. Channels do not affect image-based (environment) lighting, which every node receives.getter/setter pair - color ↔ Vector3
-
Linear RGB color of the light.
getter/setter pair
- falloffExponent ↔ double
-
The distance-falloff exponent.
2(the default) is the physical inverse square; lower values are an artistic control that lets the light reach further without blowing out its near field (a hero light touching distant scenery).0disables the distance falloff, leaving only the range window; negative values are clamped to0.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- intensity ↔ double
-
Scalar multiplier applied to color; the radiance at unit distance.
getter/setter pair
- radius ↔ double
-
World-space radius of the emitter (a bulb's size). Glossy reflections
widen to the light's apparent size, so a near-mirror shows a small disc
of bounded brightness instead of a point of unbounded radiance, and the
inverse-square falloff stops growing inside it.
0is a point source.getter/setter pair - range ↔ double
-
World-space distance at which the light's influence smoothly reaches
zero.
0means infinite range (pure inverse-square falloff, clamped near the source).getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shadowCasterChannelMask ↔ int Lighting and environment
-
The light channels whose nodes render into this light's shadow faces, an
8-bit mask (default
0xFF, every channel). A node casts only whenshadowCasterChannelMask & node.lightChannelMaskis nonzero.getter/setter pair - shadowCasterFaces ↔ ShadowCasterFaces
-
Which faces are rendered into the shadow map. ShadowCasterFaces.back
(second-depth) suits solid geometry; ShadowCasterFaces.front is the
general default.
getter/setter pair
- shadowDepthBias ↔ double
-
Window-space depth bias subtracted from the receiver before the shadow
test. Defaults to
0for the same reason as SpotLight.shadowDepthBias (a constant bias misbehaves across a perspective depth range); the normal-offset bias below does the work instead.getter/setter pair - shadowFar → double
-
The far plane of the shadow faces: the light's range, or a default
reach when the range is infinite (mirrors SpotLight).
no setter
- shadowMapResolution ↔ int
-
Pixel resolution this light asks for on each (square) cube face.
getter/setter pair
- shadowNear ↔ double
-
Near clip distance of each face's shadow frustum. Geometry closer to
the light than this does not occlude.
getter/setter pair
- shadowNormalBias ↔ double
-
World-space offset along the surface normal applied to the receiver
before the shadow lookup ("normal-offset shadows"). The main
acne/peter-panning control; world-space, so very small scenes may want
a smaller value.
getter/setter pair
- shadowSoftness ↔ double
-
Radius of the soft-shadow PCF kernel, in shadow-map texels.
0gives a hard edge.getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pointShadowFaceViewProjection(
Vector3 worldPosition, int face) → Matrix4 -
The world -> clip matrix that renders face
face(0..5, the +X, -X, +Y, -Y, +Z, -Z axes) of this light's shadow cube for a light atworldPosition. A 90 degree square frustum from shadowNear to shadowFar. The per-face basis must stay in lockstep with the dominant-axis face selection in material_shadow_sampling.glsl (SamplePointShadow), which reconstructs the same mapping analytically. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited