Hal Canary (hwc) wrote in sl_creators,
Hal Canary
hwc
sl_creators

transparentify object/prim invisible

This one does the whole object:
// a simple script to make an object
// 100% transparent, then deletes itself.
// Dedicated to the public domain.
default {
    state_entry() {
        llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
        llRemoveInventory(llGetScriptName());
    }
}

And this one does a single prim:
// a simple script to make a prim 100%
// transparent, then deletes itself.
// Dedicated to the public domain.
default {
    state_entry() {
        llSetAlpha(0.0, ALL_SIDES);
        llRemoveInventory(llGetScriptName());
    }
}

<rant>
I'm sure that everyone these days knows how transparency and color work with images/textures in SL. Images have four channels---red, blue, green, and alpha, where alpha is the level of transparency. Each side of a prim has a texture and a color, which gets multiplies together to make the resulting color.

Consequently, there are two ways to make a 100% transparent object: One can create a 100% transparent texture using an image editor, upload it to the Asset Server, then use that texture anywhere you want transparency. Or one can use a script to set the transparency of the prim to 100% and leave the texture blank.

The second method has several advantages:

1) It reduces load on the Asset Server.
2) It saves Linden Labs hard drive space. Think of how many separate 100% transparent textures have been uploaded by how many users!
3) The object will appear transparent much faster---no waiting for the texture to download.
4) Saves work on the client side. Once the client sees that one variable is set to fully transparent, there is no need to do any rendering. If it has to look at an entire image looking for non-transparent pixels, that will take more time.

Number 3 is the important one for me. How many times have you seen a great big gray orb hanging in front of an avatar's face---a face lamp---because you were waiting to download a texture that is just going to tell the client not to render the orb in the first place!
</rant>
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 2 comments