Skip to content

llGetAlpha

float llGetAlpha(integer Face)

Returns the alpha value of Face.

Returns the 'alpha' of the given face. If face is ALL_SIDES the value returned is the mean average of all faces.

Parameters
Face (integer)

Reports the alpha value for each face on the prim:

//Tells the owner the alpha on all sides
default
{
state_entry()
{
integer i = 0;
integer max = llGetNumberOfSides();
while(i < max)
{
llSay(0,"Face "+(string)i+" alpha is " + (string)llGetAlpha(i));
++i;
}
}
}

Calculate the average alpha across all faces:

float AveragePrimAlpha()
{
//Since this is so simple you may just want to inline it instead of including the function.
return (llGetAlpha(ALL_SIDES) / llGetNumberOfSides());
}

Check if a face is transparent and make the prim visible if it’s not:

//if face 0 is "transparent" then make the prim "visible"
if (llGetAlpha(0)) ;
else llSetAlpha(1.0, ALL_SIDES);

Alpha is stored in a single 8-bit byte, meaning there are 256 possible values. Consequently, the values returned by this function are all multiples of 1/255. When the alpha value is initially stored, the float value is rounded to the nearest multiple, turning 0.5 into 128/255 for example.