PRIM REFLECTION PROBE

From Second Life Wiki
Revision as of 11:34, 4 April 2024 by Maestro Linden (talk | contribs) (Remove warning about the feature being experimental)
Jump to navigation Jump to search


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 100.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 100.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.


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;