Jul 11, 2010

#SecondLife Tip: Less Buggy Transparency

Sometimes, no matter how hard we try to build our creations, we inevitably end up having to use textures with alpha transparency. While the occasional usage of alpha transparent textures isn't a taboo in and of itself, those of you who have been building for quite some time in Second Life will know that Alpha Transparencies don't play well with others.

What this boils down to is, Invisi-prims glitching on dancefloors, flexi hair disappearing in front of a window, and god forbid you're in a forest... all of the trees have totally messed up sorting order at times, making for some really trippy effects as you walk around.

To this end, the culprit seems to be that nobody (apparently) has solved the Z-Order Depth Sorting bug for alpha transparent textures on faces in a 3D scene. So what ends up happening is that the tree which is 100 feet away ends up rendering in front of the window that is 5 feet away from you.

There is, however, a solution to this alpha blending glitch on translucent items in a virtual space, but it's an internal solution which requires coding. Unfortunately, you aren't likely to go through that sort of trouble just to stop tripping balls walking in Second Life forests or watching your hair disappear on the dancefloor.

So there is a simpler solution, but it's still a trade off in quality:
  • Open your Debug Settings in Advanced Menu (CTRL ALT D)
  • In Debug, type in RenderFastAlpha
  • Set this to TRUE

What this does is switches to a different type of Alpha Blending known as Clip Alpha whereas the default for Second Life is actually Alpha + Sort. The trade off is that the transparency of the textures will gain a hard edge and likely not blend as well as the default (Soft Blending) and thus you will have some pixelation and jagged edges on them. The upshot of this method is that you'll immediately notice that the items in question are likely to snap into proper depth calculation and render in proper Z-Order.

Is this a perfect solution? No, by no means. But it should at least keep those trees in proper order in the meantime.

The internal method for fixing this would be to apply a Gaussian Blur shader algorithm to the Clip Alpha in order to smooth the edges. As for invisible prims (used to hide parts of your body while wearing items) - the solution to this is in the Viewer 2.0 ability to use Alpha transparent textures on your skin, making parts invisible versus wrapping alpha transparent objects around the body parts to hide them. As far as Flexi-Hair goes, however... that's a horse of a different color.


Post a Comment