Difference between revisions of "PRIM REFLECTION PROBE"

From Second Life Wiki
Jump to navigation Jump to search
(Fix incorrectly documented constant number. Thanks arton Rotaru for pointing this out)
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:
  |mode=warning
  |mode=warning
  |title_desc=Future feature
  |title_desc=Future feature
  |desc=This function will be supported in the upcoming GLTF Materials project.</b><br/>Currently it will only work in supported testing areas with a supported test viewer.
  |desc=This feature will be supported in the upcoming GLTF Materials project.</b><br/>Currently it will only work in supported testing areas with a supported test viewer.
  }}
  }}
<onlyinclude>{{#if:
<onlyinclude>{{#if:
{{LSL_Function/boolean|boolean}}
{{#vardefine:reflection_probe_const|{{LSL Const|PRIM_REFLECTION_PROBE|integer|44|c=Used to {{GetSet|{{{1|}}}|get|set|/}} the prim's reflection probe configuration}}}}
{{#vardefine:reflection_probe_const|{{LSL Const|PRIM_REFLECTION_PROBE|integer|44|c=Used to {{GetSet|{{{1|}}}|get|set|/}} the prim's reflection probe configuration}}}}
{{#vardefine:p_ambiance_desc|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. }}
{{#vardefine:p_ambiance_desc|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. }}
Line 10: Line 11:
{{#vardefine:p_flags_desc|PRIM_REFLECTION_PROBE_* flags}}
{{#vardefine:p_flags_desc|PRIM_REFLECTION_PROBE_* flags}}
}}
}}
{{#vardefine:physics_shape_type_rows|
{{#vardefine:reflection_probe_flags_rows|
!{{!}} {{LSLPT|pstype|type}} Flags
!{{!}} {{LSLPT|pstype|type}} Flags
! title="value" {{!}} V
! title="value" {{!}} V
Line 21: Line 22:
{{!}} colspan="3" {{!}} Unset by default (probe is a sphere)
{{!}} colspan="3" {{!}} Unset by default (probe is a sphere)
{{!}}-
{{!}}-
{{!}} {{LSL Const|PRIM_REFLECTION_PROBE_DYNAMIC|integer|3|c=Determines if avatars are included by the probe for imaging.}}
{{!}} {{LSL Const|PRIM_REFLECTION_PROBE_DYNAMIC|integer|2|c=Determines if avatars are included by the probe for imaging.}}
{{!}} {{#var:value}}
{{!}} {{#var:value}}
{{!}} colspan="3" {{!}} {{#var:comment}}
{{!}} colspan="3" {{!}} {{#var:comment}}
Line 32: Line 33:
|type=integer
|type=integer
|value=44
|value=44
|desc=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.
|desc=PRIM_REFLECTION_PROBE is used to change the reflection probe configuration of the prim.
 
A reflection probe is a volume used for image-based lighting (IBL). It takes an image of its surroundings and uses it as the basis for reflection effects (shiny surfaces) and ambiance effects (light bouncing).
 
Typically, the viewer automatically places reflection probes. Prim-based probes enable artists to provide hints to the render engine to improve the quality of image based lighting. Only objects in the probe's influence volume are affected.
 
Lighting is most accurate when the edges of a probe volume are near the geometry that appears in reflections. For example, objects inside a room with a box shaped reflection probe that hugs the walls, floor, and ceiling would show accurate reflections and ambient lighting from the walls of the room.
|pa={{LSL Constant/List|i_front=[&#32;{{#var:reflection_probe_const}},&#32;|i_end=&nbsp;]
|pa={{LSL Constant/List|i_front=[&#32;{{#var:reflection_probe_const}},&#32;|i_end=&nbsp;]
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]] & [[llSetLinkPrimitiveParamsFast]]
|text=When used with [[llSetPrimitiveParams]] & [[llSetLinkPrimitiveParams]] & [[llSetLinkPrimitiveParamsFast]]
|toc=llSetPrimitiveParams
|toc=llSetPrimitiveParams
|i1_type=integer|i1_subtype=boolean|i1_name=enabled
|i1_type=integer|i1_subtype=boolean|i1_name=boolean
|i2_type=float|i2_name=ambiance
|i2_type=float|i2_name=ambiance
|i3_type=float|i3_name=clip_distance
|i3_type=float|i3_name=clip_distance
Line 43: Line 50:
{{{!}} class="sortable" {{Prettytable|style=margin-top:0;}}
{{{!}} class="sortable" {{Prettytable|style=margin-top:0;}}
{{!}}- {{Hl2}}
{{!}}- {{Hl2}}
{{#var:physics_shape_type_rows}}
{{#var:reflection_probe_flags_rows}}
{{!}}}
{{!}}}
}}
}}
Line 50: Line 57:
|text
|text
|toc=llGetPrimitiveParams
|toc=llGetPrimitiveParams
|r1_type=integer|r1_subtype=boolean|r1_name=enabled
|r1_type=integer|r1_subtype=boolean|r1_name=boolean
|r2_type=float|r2_name=ambiance
|r2_type=float|r2_name=ambiance
|r3_type=float|r3_name=clip_distance
|r3_type=float|r3_name=clip_distance
Line 58: Line 65:
{{{!}} class="sortable" {{Prettytable|style=margin-top:0;}}
{{{!}} class="sortable" {{Prettytable|style=margin-top:0;}}
{{!}}- {{Hl2}}
{{!}}- {{Hl2}}
{{#var:physics_shape_type_rows}}
{{#var:reflection_probe_flags_rows}}
{{!}}}
{{!}}}
|examples=
|examples=
Set the prim's color and the color of the light it emits to the same color:-
Increase the prim's reflection probe ambiance when an agent is detected in the sensor range of the prim. Decrease the probe ambiance when an agent is no longer detected.
<syntaxhighlight lang="lsl2">
<syntaxhighlight lang="lsl2">
integer switch;
integer probe_enabled = TRUE;
vector gLampCol = <255,190,121>; //Light colour in regular (0-255) sRGB space. This will be converted to LSL later.
float probe_no_agent_ambiance = 0.0;
float probe_agent_ambiance = 1.0;
float probe_clip_distance = 0.0;
integer probe_flags = 0;
 
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         gLampCol /= 255; //Convert to LSL colour.
         integer sensor_type = AGENT;
        float sensor_range = 3.0;
        float sensor_rate = 5.0;
        llSensorRepeat("", "", sensor_type, sensor_range, PI, sensor_rate);
     }
     }


     touch_start(integer total_number)
     sensor(integer num_detected)
     {
     {
         switch = !switch; //toggle the switch
         llSetPrimitiveParams([PRIM_REFLECTION_PROBE, probe_enabled, probe_agent_ambiance, probe_clip_distance, probe_flags]);
        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,
    no_sensor()
            PRIM_GLOW,ALL_SIDES,switch,
    {
            PRIM_FULLBRIGHT,ALL_SIDES,switch]);
        llSetPrimitiveParams([PRIM_REFLECTION_PROBE, probe_enabled, probe_no_agent_ambiance, probe_clip_distance, probe_flags]);
     }
     }
}
}
</syntaxhighlight>
</syntaxhighlight>
|constants
|constants

Revision as of 14:22, 2 November 2022

Emblem-important-red.png Warning! Future feature

This feature will be supported in the upcoming GLTF Materials project.
Currently it will only work in supported testing areas with a supported test viewer.


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.

A reflection probe is a volume used for image-based lighting (IBL). It takes an image of its surroundings and uses it as the basis for reflection effects (shiny surfaces) and ambiance effects (light bouncing).

Typically, the viewer automatically places reflection probes. Prim-based probes enable artists to provide hints to the render engine to improve the quality of image based lighting. Only objects in the probe's influence volume are affected.

Lighting is most accurate when the edges of a probe volume are near the geometry that appears in reflections. For example, objects inside a room with a box shaped reflection probe that hugs the walls, floor, and ceiling would show accurate reflections and ambient lighting from the walls of the room.

llSetPrimitiveParams

[ PRIM_REFLECTION_PROBE, integer boolean, float ambiance, float clip_distance, integer flags ]
• integer boolean TRUE enables, FALSE disables
• 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 boolean, float ambiance, float clip_distance, integer flags ]

• integer boolean TRUE enables, FALSE disables
• 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 2 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. Imaging avatars in probes has a performance cost.
All Issues ~ Search JIRA for related Bugs

Examples

Increase the prim's reflection probe ambiance when an agent is detected in the sensor range of the prim. Decrease the probe ambiance when an agent is no longer detected.

integer probe_enabled = TRUE;
float probe_no_agent_ambiance = 0.0;
float probe_agent_ambiance = 1.0;
float probe_clip_distance = 0.0;
integer probe_flags = 0;

default
{
    state_entry()
    {
        integer sensor_type = AGENT;
        float sensor_range = 3.0;
        float sensor_rate = 5.0;
        llSensorRepeat("", "", sensor_type, sensor_range, PI, sensor_rate);
    }

    sensor(integer num_detected)
    {
        llSetPrimitiveParams([PRIM_REFLECTION_PROBE, probe_enabled, probe_agent_ambiance, probe_clip_distance, probe_flags]);
    }
    
    no_sensor()
    {
        llSetPrimitiveParams([PRIM_REFLECTION_PROBE, probe_enabled, probe_no_agent_ambiance, probe_clip_distance, probe_flags]);
    }
}

Deep Notes

Search JIRA for related Issues

Signature

integer PRIM_REFLECTION_PROBE = 44;