View Full Version : Alpha mapping, blending and masking

04 April 2007, 08:01 PM
I have seen that most artists use alpha maps to do alpha blending. The maps are often black/white (eg. 1-bit) but stored as 8-bit format and plugged into alpha blend slot. So my question is, does the current engines have different routines(or shaders) to handle alpha blends and alpha masks? And what are the performance differences? Isn't it pretty fast to do 1-bit masking?

04 April 2007, 08:22 PM
I think you're going to need to be more specific. What engines are you interested in?

For example, in compositing its not uncommon to work with 32-bit (float) alpha maps.

04 April 2007, 12:07 AM
eh.. I mean realtime graphic engines. I meant that most artists work with 8-bit maps when 1 bit would be sufficient. And secondly masking and blending are completely different operations, so I'm just interested why masking with 1-bit alpha maps aren't used.

04 April 2007, 12:18 PM
It's generally faster as 99.9% of all hardware operations are all geared towards 8Bit operations so to use a 1Bit value you first have to convert it to an 8Bit value before you can use it which takes extra processing cycles. Same reason that compiling for speed usually gives you larger executables.

To clarify:

The smallest addressable memory space in a modern computer is 8Bits[1], this means that any data consisting of less than 8Bits has to be dealt with as part of an 8Bit set, even if all the other parts are defunct. So to deal with a 1 bit alpha mask you have to deal with the mask in 8Bit chunks in which you have to put the chunk through a bitwise mask eight times and bitshift seven of the resulting values before you can even do any useful maths with the values.

So unless memory is a much greater concern than CPU cycles, it's just not worth the hassle and slowdown.

[1] Historically a byte was the smallest addressable memory space in a computer system and could be any size from one bit upwards. This definition doesn't apply any more though, unless you're working with some seriously legacy systems.

CGTalk Moderation
04 April 2007, 12:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.