It should work fine with 16 bit (see the $fcfcfc masking I do), or to be exact 15 bit textures as 1 bit gets allocated as the mask bit.
ReadPixel converts the mask bit in textures so it will always be present in the top bit of the rgba value returned hence the ability of the second pass to check for zero as all solid black pixels will have at least the top bit set in the returned rgba value.
off the top of my head
Function CalcRGBA(r,g,b,a)
return b or (g shl 8) or (r shl 16) or (a shl 24)
End Function
and
Function GetAlpha(rgba)
return rgba shr 24
End Function
ReadPixel converts the mask bit in textures so it will always be present in the top bit of the rgba value returned hence the ability of the second pass to check for zero as all solid black pixels will have at least the top bit set in the returned rgba value.
off the top of my head
Function CalcRGBA(r,g,b,a)
return b or (g shl 8) or (r shl 16) or (a shl 24)
End Function
and
Function GetAlpha(rgba)
return rgba shr 24
End Function