KX_LightObject
Base class: KX_GameObject
A Light object.
# Turn on a red alert light.import Range
co = Range.logic.getCurrentController()light = co.owner
light.energy = 1.0light.color = [1.0, 0.0, 0.0]A spot light source. See attribute type
A point light source with no attenuation. See attribute type
NORMAL
Section titled “NORMAL”A point light source. See attribute type
A hemi light source. See attribute type
The type of light - must be SPOT, SUN or NORMAL
energy
Section titled “energy”The brightness of this light.
Type: float
shadowClipStart
Section titled “shadowClipStart”The shadowmap clip start, below which objects will not generate shadows.
Type: float (read only)
shadowClipEnd
Section titled “shadowClipEnd”The shadowmap clip end, beyond which objects will not generate shadows.
Type: float (read only)
shadowFrustumSize
Section titled “shadowFrustumSize”Size of the frustum used for creating the shadowmap.
Type: float (read only)
shadowBindId
Section titled “shadowBindId”The OpenGL shadow texture bind number/id.
Type: int (read only)
shadowMapType
Section titled “shadowMapType”The shadow shadow map type (0 -> Simple; 1 -> Variance)
Type: int (read only)
shadowBias
Section titled “shadowBias”The shadow buffer sampling bias.
Type: float (read only)
shadowBleedBias
Section titled “shadowBleedBias”The bias for reducing light-bleed on variance shadow maps.
Type: float (read only)
useShadow
Section titled “useShadow”Returns True if the light has Shadow option activated, else returns False.
Type: boolean (read only)
shadowColor
Section titled “shadowColor”The color of this light shadows. Black = (0.0, 0.0, 0.0), White = (1.0, 1.0, 1.0).
Type: mathutils.Color (read only)
shadowMatrix
Section titled “shadowMatrix”Matrix that converts a vector in camera space to shadow buffer depth space.
Computed as: mat4_perspective_to_depth * mat4_lamp_to_perspective * mat4_world_to_lamp * mat4_cam_to_world.
mat4_perspective_to_depth is a fixed matrix defined as follow:
0.5 0.0 0.0 0.5 0.0 0.5 0.0 0.5 0.0 0.0 0.5 0.5 0.0 0.0 0.0 1.0
.. note:
There is one matrix of that type per lamp casting shadow in the scene.
Type: Matrix4x4 (read only)
distance
Section titled “distance”The maximum distance this light can illuminate. (SPOT and NORMAL lights only).
Type: float
The color of this light. Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0].
Type: list [r, g, b]
lin_attenuation
Section titled “lin_attenuation”The linear component of this light’s attenuation. (SPOT and NORMAL lights only).
Type: float
quad_attenuation
Section titled “quad_attenuation”The quadratic component of this light’s attenuation (SPOT and NORMAL lights only).
Type: float
spotsize
Section titled “spotsize”The cone angle of the spot light, in degrees (SPOT lights only).
Type: float in [0 - 180].
spotblend
Section titled “spotblend”Specifies the intensity distribution of the spot light (SPOT lights only).
Type: float in [0 - 1]
shadowMapSize
Section titled “shadowMapSize”Shadow map resolution in pixels (the lamp’s Size). Setting it resizes the shadow buffer on the fly without recompiling shaders, for a shadow quality option (e.g. 512 / 1024 / 2048). Cascaded shadow maps keep their ratio to it. Reads 0 when the lamp has no shadow buffer. Point lamps keep their own size.
Type: integer from 64 to 16384 (clamped to the graphics card maximum).
staticShadow
Section titled “staticShadow”Enables static shadows. By default (staticShadow=False) the shadow cast by the lamp is recalculated every frame. When this is not needed, set staticShadow=True. In that case, call :pyupdateShadow to request a shadow update.
Type: boolean.
updateShadow()
Section titled “updateShadow()”Set the shadow to be updated next frame if the lamp uses a static shadow, see staticShadow.
Not in the Range documentation
Section titled “Not in the Range documentation”These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.
autoShadowUpdate
Section titled “autoShadowUpdate”new in Anastacio attribute
When False, this light shadow stops being recomputed every frame (saves GPU in static scenes).
