PRIM REFLECTION PROBE
Warning! Future feature | |
This function will be supported in the upcoming GLTF Materials project. |
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Description
Constant: integer PRIM_REFLECTION_PROBE = 44;The integer constant PRIM_REFLECTION_PROBE has the value 44
PRIM_REFLECTION_PROBE is used to change the reflection probe configuration of the prim. This allows for author-positioned reflection probes. Reflection probes approximate reflective effects on shiny surfaces, and (optionally) environmental lighting effects from nearby objects. Effects are most accurate when viewed from the position of the reflection probe prim. The size and shape of the reflection probe determines the surface from which surrounding light is imaged for these effects.
llSetPrimitiveParams
[ PRIM_REFLECTION_PROBE, integer enabled, float ambiance, float clip_distance, integer flags ]• integer | enabled | |||
• float | ambiance | – | Ranges from 0.0 to 1.0. Is the brightness of lighting effects from the probe, but not reflection effects. If the environment settings has nonzero reflection probe ambiance, the effective probe ambiance is the greater of the two. | |
• float | clip_distance | – | Ranges from 0.0 to 1024.0. Is the minimum distance from the probe's center where the surroundings are included for imaging. | |
• integer | flags | – | PRIM_REFLECTION_PROBE_* flags |
When used with llSetPrimitiveParams & llSetLinkPrimitiveParams & llSetLinkPrimitiveParamsFast
llGetPrimitiveParams
llGetPrimitiveParams([ PRIM_REFLECTION_PROBE ]);Returns the list [ integer enabled, float ambiance, float clip_distance, integer flags ]
• integer | enabled | |||
• float | ambiance | – | Ranges from 0.0 to 1.0. Is the brightness of lighting effects from the probe, but not reflection effects. If the environment settings has nonzero reflection probe ambiance, the effective probe ambiance is the greater of the two. | |
• float | clip_distance | – | Ranges from 0.0 to 1024.0. Is the minimum distance from the probe's center where the surroundings are included for imaging. | |
• integer | flags | – | PRIM_REFLECTION_PROBE_* flags |
type Flags | V | Description | Notes | ||||
---|---|---|---|---|---|---|---|
PRIM_REFLECTION_PROBE_BOX | 1 | Determines if the reflection probe is a box or a sphere. | Unset by default (probe is a sphere) | ||||
PRIM_REFLECTION_PROBE_DYNAMIC | 3 | Determines if avatars are included by the probe for imaging. | Unset by default (probe does not image avatars). Imaging avatars in probes has a performance cost. |
Caveats
- A viewer must have reflections enabled to see the effects of reflection probes.
- By default, the viewer auto-places reflection probes with 0.0 ambiance. Environment settings for the region or parcel can be adjusted to increase reflection probe ambiance for these auto-placed probes.
- Automatically-placed reflection probes do not image avatars.
Related Articles
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_REFLECTION_PROBE,switch,llsRGB2Linear(gLampCol),1,20,0, //Convert colour to linear RGB as PRIM_REFLECTION_PROBE requires, using llsRGB2Linear
PRIM_COLOR,ALL_SIDES,gLampCol,1,
PRIM_GLOW,ALL_SIDES,switch,
PRIM_FULLBRIGHT,ALL_SIDES,switch]);
}
}