PRIM POINT LIGHT
Looking for the current API? Open the PRIM_POINT_LIGHT reference →
Wiki description
PRIM_POINT_LIGHT is used to configure the point light configuration of the prim
Caveats
- Viewers that do not have advanced lighting enabled can only render 6 lights at a time and projectors will be rendered as omnidirectional light sources. (OpenGL limitations allow for 8 light sources, SL appears to reserve one each for the Sun and Moon.)
- Viewers that do have advanced lighting enabled can render as many lights as their graphics card allows; it is not hard-limited by the viewer.
- Lights with a high intensity have a wash-out effect when overlapping. Keep this in mind when using multiple lights. Never create an abundance of lights to get around the 6 light maximum in basic lighting, as viewers with advanced lighting will be washed out and may suffer from client lag.
- Unlike most color in LSL, which expects a gamma-encoded value (sRGB), this expects a non-gamma-encoded value (linear RGB). This means that the value you set as the light color is not the same value you'd pass to make the source (e.g. filament ) glow the same color. You may wish to implement an sRGB Electro-Optical Transfer Function (EOTF) to bypass this.
- The
falloffparameter is a bit of a misnomer. Instead of modifying the characteristics of light decay over distance, it instead acts as a modifier to a light's overall intensity value.
Examples
Set the prim's color and the color of the light it emits to the same color:-
integer switch;
vector gLampCol = <255,190,121>; //Light colour in regular (0-255) sRGB space. This will be converted to LSL later.
default
{
state_entry()
{
gLampCol /= 255; //Convert to LSL colour.
}
touch_start(integer total_number)
{
switch = !switch; //toggle the switch
llSetLinkPrimitiveParamsFast(LINK_THIS,[
PRIM_POINT_LIGHT,switch,llsRGB2Linear(gLampCol),1,20,0, //Convert colour to linear RGB as PRIM_POINT_LIGHT requires, using llsRGB2Linear
PRIM_COLOR,ALL_SIDES,gLampCol,1,
PRIM_GLOW,ALL_SIDES,switch,
PRIM_FULLBRIGHT,ALL_SIDES,switch]);
}
}Basic light script:-
integer isLightTurnedOn;
default
{
touch_start(integer total_number)
{
// toggle isLightTurnedOn between TRUE and FALSE
isLightTurnedOn = !isLightTurnedOn;
if (isLightTurnedOn)
{
llSetPrimitiveParams([
PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 1.0, 10.0, 0.6]);
}
else
{
vector COLOR_ORANGE = <1.000, 0.522, 0.106>;
llSetPrimitiveParams([
PRIM_FULLBRIGHT, ALL_SIDES, TRUE,
PRIM_POINT_LIGHT, TRUE, COLOR_ORANGE, 1.0, 10.0, 0.6]);
}
}
}A compact version of the above:-
integer switch;
default
{
touch_start(integer total_number)
{
llSetPrimitiveParams(
[ PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch,
PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> * switch, 1, 10, 0.6 ] );
}
}See also: functions
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Template:LSL PrimitiveParam Categorize
Original shared helper source (conditional wiki logic is not evaluated)
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#ifexist:Template:LSLC{{#var:lang}}|
{{LSLC{{#var:lang}}|PrimitiveParams}}
{{LSLC{{#var:lang}}|PrimitiveParams/{{{1}}}}}
{{LSLC{{#var:lang}}|{{{1}}}}}
|
{{LSLC|PrimitiveParams{{#var:lang}}}}
{{LSLC|PrimitiveParams/{{{1}}}{{#var:lang}}}}
{{LSLC|{{{1}}}{{#var:lang}}}}
}}
}}}}Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.