Tuesday, August 2, 2011


No, this is not a call for more visibility into Linden Lab’s policies and plans! Today’s topic is texture transparency in Second Life. Hang on tight, it’s going to get a bit technical out.

All textures in SL (in fact, most computer images everywhere) are “bitmapped”. That means that they consist of an array of tiny picture elements, or “pixels”, much like a pointillist painting. Each little pixel has a color…actually three colors. Three color channels – Red, Green, and Blue – each have a value assigned to them, usually from 0 to 255. A pixel with a value of 0,0,0 is black. One with a value of 255,255,255 is pure white. Pop quiz: What’s the RGB color value of a fully saturated green pixel? Right! 0,255,0.

The range 0-255 can be expressed by an eight bit binary number. Decimal 255 = binary 11111111. So, images that use this three color system are commonly called “24 bit color”, because 3 color channels X 8 bits = 24.

But what about transparency? Ah…that requires a fourth channel, called the “alpha channel”. This modified color system is known as RGBa, and uses 32 data bits per pixel. In the alpha channel, 0 is opacity, and 255 represents complete transparency.

Not all file formats support transparency. JPEG, for example, does not, but the .PNG or .TGA file formats do. There are many times when you don’t WANT any transparency to creep into your image, and for those occasions, a JPEG image is the better choice.

In SL, transparency can be achieved in five different ways.
  1. The transparency slider. In the Texture tab of the Build menu window, there is a scroll box for Transparency. In former days, this would only go up to 90, but in the current viewers that’s been fixed and you can dial in a 100% transparent texture. This is now the preferred method of making things transparent.
  2. A transparent texture. You can apply a texture with a 100% alpha channel to the face of a prim and make it invisible. There are many such textures out there, and you can create your own in a paint program. However, it’s suggested that you use the one in your Library, called “Default Transparent”. This is because it’s in wide use throughout SL. If you are in a place where there are ten different transparent textures in use (each with its own unique identifying UUID), your viewer has to download and render all of them. If all of those textures are the same transparent texture, your viewer’s job is made easier and things render faster.
  3. A script. You can drop a simple little script into a prim to turn it transparent.

    llSetAlpha(0.0, ALL_SIDES);

  1. An Invisiprim. This is a prim with a special script in it that makes avatar textures behind it invisible. It’s used primarily in making shoes, to mask portions of the foot that would otherwise be visible. Invisiprims are rapidly being replaced by alpha masks on the avatar mesh.
  2. Alpha masks. These are transparent textures that are applied to parts of the avatar, just like any clothing layer, rendering part of you invisible.

Textures may be only partly transparent, or transparent only over part of their area. This is great for creating images like hair, or plant leaves on a flat prim.
You can make a one way window…a prim that is transparent on one side, and opaque when looked at from the other side. For a wild example of this, go to The Free Dove and take a look at the walls of the store from inside, and from outside.
By the way, textures (any texture, not just transparent ones) are one sided. That is, you can only see them from one side. If you move your camera inside a prim, you can look out as if nothing was there. Even the ground in SL only has one side. Slide your camera under the turf sometime!
Transparent textures highlighted with CTRL+ALT+T
You can view transparent textures by toggling CTRL+ALT+T. When activated, transparent or semitransparent things are highlighted in red. You can see who has on that six-emitter facelight, or who forgot to take off their prim genitals, or who is carrying an invisible machine gun.
Many builders consider it good practice to make each prim of a structure completely transparent, then apply other textures only where needed. This results, for example, in walls that do not show seams even if they are misaligned by a tiny amount.
Alpha Conflict.  Note my collar and cuff showing through my hair
Transparent textures can produce unwanted visual effects when one is placed behind another. This results in a phenomenon called “alpha channel conflict”. The viewer does not know which transparent thing to put in front of the other. It’s particularly annoying when you have a house where the builder saved prims by making a wall with a window painted into it with an alpha channel. The entire wall, not just the clear window, can experience this alpha channel conflict, and things that are outside the house can appear to be inside.

There now. I hope that clears everything up.

No comments:

Post a Comment