constant
ConstantSet with Get with
integer PRIM_POINT_LIGHT = 23;llSetLinkPrimitiveParamsFastPRIM_POINT_LIGHT, integer enabled, vector linear_color, float intensity, float radius, float falloffllGetLinkPrimitiveParams, llGetPrimitiveParamsPRIM_POINT_LIGHT → integer enabled, vector linear_color, float intensity, float radius, float falloffinteger enabledvector linear_colorfloat intensity// Range 0–1float radius// Range 0.1–20float falloff// Range 0–2
Prim parameter to configure local lighting.
Accepts color in linear space (use llsRGB2Linear to convert from sRGB).
Other PrimParam values (42)
PRIM_ALLOW_UNSIT39PRIM_ALPHA_MODE38PRIM_BUMP_SHINY19PRIM_CLICK_ACTION43PRIM_COLLISION_SOUND53PRIM_COLOR18PRIM_DAMAGE51PRIM_DESC28PRIM_FLEXIBLE21PRIM_FULLBRIGHT20PRIM_GLOW25PRIM_GLTF_BASE_COLOR48PRIM_GLTF_EMISSIVE46PRIM_GLTF_METALLIC_ROUGHNESS47PRIM_GLTF_NORMAL45PRIM_HEALTH52PRIM_LINK_TARGET34PRIM_MATERIAL2PRIM_NAME27PRIM_NORMAL37PRIM_OMEGA32PRIM_PHANTOM5PRIM_PHYSICS3PRIM_PHYSICS_SHAPE_TYPE30PRIM_POS_LOCAL33PRIM_POSITION6PRIM_PROJECTOR42PRIM_REFLECTION_PROBE44PRIM_RENDER_MATERIAL49PRIM_ROT_LOCAL29PRIM_ROTATION8PRIM_SCRIPTED_SIT_ONLY40PRIM_SIT_FLAGS50PRIM_SIT_TARGET41PRIM_SIZE7PRIM_SLICE35PRIM_SPECULAR36PRIM_TEMP_ON_REZ4PRIM_TEXGEN22PRIM_TEXT26PRIM_TEXTURE17PRIM_TYPE9
Other PrimParamGet values (40)
PRIM_ALLOW_UNSIT39PRIM_ALPHA_MODE38PRIM_BUMP_SHINY19PRIM_CLICK_ACTION43PRIM_COLLISION_SOUND53PRIM_COLOR18PRIM_DAMAGE51PRIM_DESC28PRIM_FLEXIBLE21PRIM_FULLBRIGHT20PRIM_GLOW25PRIM_GLTF_BASE_COLOR48PRIM_GLTF_EMISSIVE46PRIM_GLTF_METALLIC_ROUGHNESS47PRIM_GLTF_NORMAL45PRIM_HEALTH52PRIM_MATERIAL2PRIM_NAME27PRIM_NORMAL37PRIM_OMEGA32PRIM_PHANTOM5PRIM_PHYSICS3PRIM_PHYSICS_SHAPE_TYPE30PRIM_POS_LOCAL33PRIM_POSITION6PRIM_REFLECTION_PROBE44PRIM_RENDER_MATERIAL49PRIM_ROT_LOCAL29PRIM_ROTATION8PRIM_SCRIPTED_SIT_ONLY40PRIM_SIT_FLAGS50PRIM_SIT_TARGET41PRIM_SIZE7PRIM_SLICE35PRIM_SPECULAR36PRIM_TEMP_ON_REZ4PRIM_TEXGEN22PRIM_TEXT26PRIM_TEXTURE17PRIM_TYPE9
PRIM_POINT_LIGHT, integer boolean, vector linear_color, float intensity, float radius, float falloff- integer boolean
- vector linear_color
- float intensity — ranges from 0.0 to 1.0
- float radius — ranges from 0.1 to 20.0
- float falloff — ranges from 0.0 to 2.01
When used with llSetLinkPrimitiveParamsFast
llGetLinkPrimitiveParams(LINK_THIS, [ PRIM_POINT_LIGHT ]);Returns the same values, in the same order.
Caveats
Section titled “Caveats”- The viewer renders only the nearest local lights, up to its
RenderLocalLightCountsetting (default 256); lights beyond that count, or outside the draw distance, are not rendered2 - 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 per-viewer light limit, as other viewers 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).3 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
Section titled “Examples”Set the prim’s color and the color of the light it emits to the same color:-
13 collapsed lines
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:-
11 collapsed lines
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) { llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_FULLBRIGHT, ALL_SIDES, switch = !switch, PRIM_POINT_LIGHT, switch, <1, 0.5, 0.1> * switch, 1, 10, 0.6 ] ); }}See also
Section titled “See also”Functions
Section titled “Functions”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.
Footnotes
Section titled “Footnotes”-
Viewer
746d768339:llprimitive/llprimitive.cpp:77-79;llprimitive/llprimitive.h:163↩ -
Viewer
746d768339:newview/app_settings/settings.xml:7733-7742;newview/pipeline.cpp:8656;newview/pipeline.cpp:8699-8702;newview/pipeline.cpp:5584-5587↩ -
Viewer
746d768339:llprimitive/llprimitive.h:138;llprimitive/llprimitive.h:155-160↩