Michi_cc posted a bit simplified details and that's just as it is in blitters now. Important consequence is that you shouldn't believe the info that's written in wiki here:Zephyris wrote:...extremely bright and saturated and my bridges are coming out very dark and with incorrect colours (light red instead of yellow, dark red instead of red, dark red instead of grey). I want to know what to do to get them looking a bit nicer!
http://wiki.openttd.org/How_to_Create_3 ... mask_files
Main thing to know when you're trying to deal with the mask is to keep in mind that the pixel is no longer 32bpp as soon as it has non-zero mask value. Think about them as a grayscale 8bpp image coupled with indexed 8bpp image producing the end-result using something like "multiply" layers combine in Photoshop or GIMP.
Mask pixel is not restricted to be from the "company colours" range, you could use any index you want except for 0. Take as example a GRF that is attached to this message: http://www.tt-forums.net/viewtopic.php? ... 1#p1037511. You could decode it with grfcodec ("grfcodec.exe -d lx2tst01.grf") and inspect the contents. There I had manually performed a sort of "8bpp->32bpp" conversion for oil refinery and radio tower and used mask to retain the palette-animated pixels just like they were in original 8bpp sprites.
Back to company colours vs. mask, I'd recommend to perform it using single mask palette index from company colour range (I'd pick 201, 202 or 203) coupled with neutral gray in base 32bpp image to control "brightness" of the result. #404040 would then result in direct translation into colour for chosen palette entry (#400000, #004000, #000040 and any other #xxyyzz where xx <= 40 && yy <= 30 && zz <= 40 and xx or yy or zz equals to 40 would also result in direct translation), #606060 would make it pretty bright, #202020 would darken it about in half and so on.