PRIM REFLECTION PROBE

From Second Life Wiki
Revision as of 14:39, 10 October 2022 by Cosmic Linden (talk | contribs)
Jump to navigation Jump to search
Emblem-important-red.png Warning! Future feature

This function 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. 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. Imaging avatars in probes has a performance cost.


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;