Skip to content
lsl.devlsl.devLSL Dev

llSetAlpha

function
Function syntax
llSetAlpha(
  1. float alpha,// Transparency value to set, from 0.0 (clear) to 1.0 (solid; clamped to a minimum of 0.1).
  2. integer face// Face number or ALL_SIDES. Values: Faces
);
Energy
10

Sets the diffuse texture alpha (opacity) of face. If face is ALL_SIDES, applies to all faces. Values are clamped between 0.1 and 1.0 (where 1.0 is fully opaque).

Sets the Blinn-Phong alpha on face

How to use
llSetAlpha(0.0, 0);
  • llSetAlpha will have no visible effect on faces with a PBR material. To work on faces both with and without a PBR material, use one of these snippets:

  • invisible

    if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES)) {
    llSetLinkGLTFOverrides(LINK_THIS, ALL_SIDES, [OVERRIDE_GLTF_BASE_ALPHA_MODE, PRIM_GLTF_ALPHA_MODE_BLEND, OVERRIDE_GLTF_BASE_ALPHA, 0.0]);
    } else {
    llSetAlpha(0.0, ALL_SIDES);
    }
  • visible

    if (llIsLinkGLTFMaterial(LINK_THIS, ALL_SIDES)) {
    llSetLinkGLTFOverrides(LINK_THIS, ALL_SIDES, [OVERRIDE_GLTF_BASE_ALPHA_MODE, "", OVERRIDE_GLTF_BASE_ALPHA, ""]);
    } else {
    llSetAlpha(1.0, ALL_SIDES);
    }
Example 1
8 collapsed lines
float cloakSpeed = 0.1;
default
{
touch_end(integer total_number)
{
float alpha = 1.0;
while(alpha > 0.0)
{
alpha -= 0.1;
llSetAlpha(alpha, ALL_SIDES);
llSleep(cloakSpeed);
}
10 collapsed lines
state cloaked;
}
}
state cloaked
{
touch_end(integer total_number)
{
float alpha;
while (alpha < 1.0)
{
alpha += 0.1;
llSetAlpha(alpha, ALL_SIDES);
llSleep(cloakSpeed);
}
state default;
}
}

In practical terms, “alpha” means “transparency” or “visibility”.

To be clear, llSetAlpha will only affect the prim that the script it is in. It will not affect any linked prims. To set the alpha state for those, use llSetLinkAlpha

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.