Jump to content

Alpha blending, alpha masking, emissive mask... what and how?


You are about to reply to a thread that has been inactive for 3789 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Alpha blending is what used to happen with all alpha textures. It allows the view behind to be seen through it. The light from behind is mixed with the an amount of rgb part of the texture determined by the intensity of the alpha channel. Thus black in the alpha channel is completely transparent and white is completely opaque, while values in between mix the light in different proportions.

Alpha masking only has completely opaque or completely transparent pixels. There is a settable cutoff value of the alpha intensity, below which pixels are completely transparent and above which they are completely opaque. Unlike alpha blending, this kind of transparenct doesn't suffer from the alpha sorting glitch.

Emissive masking means no trasparency. Instead, the alpha pixel values control the intensity of emitted light when there is low of no ambient lighting. White in the alpha channel makes a pixel like full bright. Black leaves it as it is without the alpha channel. Intermediate greys produce intermediate brightness. (Not so sur about that - someone correct me if that's not accurate).

Note that if you set the overall transparency of the texture to anything other than 0, then it will revert to alpha blending.

Here is a picture. All the squares have the same texture, viewed against a white wall, which looks grey because it's not in full sunlight. The top three are set to alpha masing, with three different cutoff settings. Below are none, alpha blending and emissive masking.

boababalphas.jpg

  • Like 6
Link to comment
Share on other sites

Thanks so far, Drongle. You can explain very well. But I have more questions...

Lets say I must texture a glass. I get three different results when I use the three different options. However if I then give the alpha masking or emissive masking a bit or transparency, it looks almost the same as the blending mode.

6glasses.png

So for the looks so far (without using anything of the material system yet), we don't have to care which option we choose.
And for the system or the lag, does it make a difference for that, which option you choose of these three?

And does it make any difference when you start using the normal and speculair options, which alpha mode you choose?

Link to comment
Share on other sites

Since Drongle is offline....

You must have missed what he said about transparancy:

"Note that if you set the overall transparency of the texture to anything other than 0, then it will revert to alpha blending."

So it doesn't look almost the same, it is the same.

I haven't tested it, but it would make sense that masking is easier on your computer than blending, since it takes less calculation. It's all local, so if your computer is up to the task, both will work. I'd use the alpha mode that best suits what you are after. If you don't see any or a lot of difference, I'd always pick masking.

For your object though, you can't easily use masking. Masking means either full transparancy or full opaqueness. So parts of your glass would either be invisible or they wouldn't be transparant at all, like you see in the top middle picture you posted.

Alpha masks are for example good for trees if you don't mind the jagged edges or for holes in very low poly walls.

Normal, specular and alpha are three different characteristics, so you can mix and match any way you like.

Link to comment
Share on other sites

  • 5 months later...


Kwakkelde Kwak wrote:

Alpha masks are for example good for trees if you don't mind the jagged edges or for holes in very low poly walls.

I'm just filling in a bit of extra information.

There's a trade off here that lends itself favourably to masking in these situations. Blended alpha is troublesome in 3D environments. Not just SL, but all realtime 3D environments (ie: videogames).

3D engines have trouble rendering overlapping blended alpha. This is the source of a "alpha sorting/flicker" bug that has plagued SL since the beginning, where overlapping alpha masks seem to pop through one another. This is particularly noticeable in nature sims with lots of plants, or houses that use alpha for walls with windows or doorways in them.

Blended alpha surfaces are also tricky to light properly, this is why surfaces with blended alpha may appear much darker or brighter than non-alpha surfaces. You often see this at night and with nearby light sources.

 On the flip side, if an alpha channel is made well, the "jaggies" aren't all that noticeable. You can also adjust the masking strength and in many cases reduce the jagged edges that way. 

 

 In every single case I've employed masked alpha, the sharper edges were less noticeable than the problems Blended Alpha brings to the table. This is also why artists on videogames avoid blended alpha unless absolutely necessary (ie: glass windows, water, fog).

By avoiding unnecessary use of blended alpha, you also reduce the problems present when blended alpha is necessary. For instance, if you tried to make a foggy forest using blended alpha for everything, you'd frequently hae plants popping through the fog due to the alpha sorting issue. If you made the plants masked alpha, they, and the fog, would render properly.

 I created a fantasy sim in Second Life which included a mesh forest and some fantasy sky elements (multiple moons, the milky way stretching across the night sky), using blended alpha the alpha elements in the sky would pop through the forest canopy. By switching to masked alpha for the forest, the blended elements of the night sky rendered properly through the trees.

Or, if you had an avatar standing behind a window. If the avatgar's hair used blended alpha, it would pop through the window very noticeably. If the hair used masked alpha it would render properly behind the glass.

 

Another thing to consider is that blended alpha requires considerably more effort to render than masked alpha. So by using masked alpha in place of blended, you can increase framerates.

 

Because of all this, now that we have masked alpha I'd encourage people to use it whenever possible. 

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3789 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...