Difference between revisions of "PRIM POINT LIGHT"

From Second Life Wiki
Jump to navigation Jump to search
(Add caveat about expected colour value. Removed caveat regarding projector lamps as new functions had made it irrelevant.)
(Add link to example EOTF function.)
Line 35: Line 35:
** 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.
** 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.
* 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.
* 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 [[User:Jenna Huntsman#sRGB_EOTF|sRGB Electro-Optical Transfer Function (EOTF)]] to bypass this.
|examples=
|examples=
<source lang="lsl2">
<source lang="lsl2">

Revision as of 03:44, 18 April 2022

Description

Constant: integer PRIM_POINT_LIGHT = 23;

The integer constant PRIM_POINT_LIGHT has the value 23

PRIM_POINT_LIGHT is used to configure the point light configuration of the prim

llSetPrimitiveParams

[ PRIM_POINT_LIGHT, integer boolean, vector color*, float intensity, float radius, float falloff ]
• integer boolean TRUE enables, FALSE disables
• vector color*
• float intensity ranges from 0.0 to 1.0
• float radius ranges from 0.1 to 20.0
• float falloff ranges from 0.01 to 2.0

When used with llSetPrimitiveParams & llSetLinkPrimitiveParams & llSetLinkPrimitiveParamsFast

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_POINT_LIGHT ]);

Returns the list [ integer boolean, vector color, float intensity, float radius, float falloff ]

• integer boolean TRUE enables, FALSE disables
• vector color color in RGB <R, G, B> (<0.0, 0.0, 0.0> = black, <1.0, 1.0, 1.0> = white)
• float intensity ranges from 0.0 to 1.0
• float radius ranges from 0.1 to 20.0
• float falloff ranges from 0.01 to 2.0

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.
All Issues ~ Search JIRA for related Bugs

Examples

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 ] );      
    }
}

Deep Notes

Search JIRA for related Issues

Signature

integer PRIM_POINT_LIGHT = 23;