lightrange
Range of a dynamic light.
If this parameter is set above zero, the entity begins to emit
light that affects all objects within the lightrange according
to their material setting.
The light color and brightness can be set through the entities' blue,
green, red parameters.
Range:
0 .. 2000 (default: 0 - no light)
Type:
var
Remarks
-
The A7 light manager supprts an arbitrary number of dynamic lights
that are visible at the same time
. The maximum number of lights can be set through the max_lights variable
(default: 100 for A7, 8 for A6). The light
manager uses the ABT for calculating which objects
lie in the ranges of which lights, and generates lists of close lights for
every object. This calculation, although very fast, is an additional rendering
process that can affect the frame rate, depending on the number and ranges
of active lights. For overcoming the 8 lights limit of today's 3D hardware,
light sources are dynamically switched on and off during rendering while
taking care that no more than 8 lights are active at any time.
- Dues to the hardware limitation, a single entity, block, or
terrain chunk can still not receive light from more than 8 dynamic light
sources simultaneously. If an object lies within the ranges of more than
8 lights, it is affected by the 8 most recently created lights only. This
ensures that creating a new light has an immediate effect on the environment
even if many dynamic lights are already around.
- For using the light manager,
levels and map entities must be compiled in mesh mode (Create
Mesh activated). Otherwise only 8 lights can be active at a time.
Terrain should be chunked; the smaller the chunks, the less visible are light
swapping effects when more than 8 lights move in or out of the range of a
chunk.
- Dynamic light can be spherical (point lights, default), conical (spotlight),
or directional (sunlight). The behavior of the
light reflection is affected by the d3d_pointlightfalloff vector.
- Without shaders, the light reflections are interpolated between vertices.
The distance between vertices on level surfaces depends on the tesselation
(adjustable in the Map Compiler); the default value is 200 pixels. This is
sufficient for medium-range point lights, but short-range lights or spotlights
might require a smaller distance between vertices.
action blink()
{
vec_set(my.blue,vector(255,255,0)); // blue-green color
while(1)
{
my.lightrange = 500; // lightsphere 500 quants
wait(-1); // wait one second
my.lightrange = 0; // no light
wait(-1); // wait one second
}
}
See also:
SPOTLIGHT,
LIGHT, material,
d3d_lightres
► latest
version online