Alpha map for mat files

eddieb

Vice Admiral
Nice work on standoff.

Question: I need a tool that can extract the alpha channels from mats into a useable format (bmp, png, etc). Do you know of anything that can do this. I typically use Thomas Bruchner's texconv, but I don't see any options to get alpha, I'm only able to extract rgb. The texconv OpenGl option seems like it should support this, but the file format doesn't seem to be documented.

If not, I'm prepared to write my own. Do you know if the alpha chunk of the mat is encoded using RLE (run length encoding)?
 
eddieb said:
I need a tool that can extract the alpha channels from mats into a useable format (bmp, png, etc). Do you know of anything that can do this.
I don't think there's any tool that can do that right now. We can't even be sure which textures use alpha channels, since as you said texconv always shows just the rgb.

eddieb said:
If not, I'm prepared to write my own. Do you know if the alpha chunk of the mat is encoded using RLE (run length encoding)?
I don't know, but have you looked at HCl's bmp2mat.exe? I don't know any of the technicalities of how the conversion works, but that's the tool I use to encode two bmps into an alpha-mapped mat (and AFAIK the only tool that does that). I'm sure Mario would provide you with the source code if you talked to him about it.
 
Yep. Basically, at the moment, all we can do is encode alpha channel maps - there are no tools to decode them.

What we do know is that alpha channel maps are basically grayscale images, with white being fully transparent and black being fully visible. Also, while I don't remember for sure, I believe they use the same kind of encoding as MATs do.

When I'm a bit less busy taking a break from Standoff, I'll dig up for you the example of an ALPHA chunk, so that you can have a look at it and maybe create a tool to turn it into a grayscale image.

(I certainly wouldn't mind such a tool - I've very rarely had the need for it, but it was a major problem when I did need it)
 
It went surprisingly well, I created the tool in a few hours. It runs through your mat and pal directory and converts everything to pngs. For images with alpha channels, it makes a 4-channel png (rgb + alpha) , and another png with just the alpha channel by itself. Anyway, if anybody wants it, let me know. Thanks for your help, just wanted to make sure I wasn't duplicating effort.
 
Whoa, ouch, it converts everything? :p I can understand that's very useful for you, given the nature of your project, but would it be possible to get a version that only converts the files that you select? ;)
 
Neat, thanks. I've only now had a chance to download it (haven't even visted the CZ since New Year's day :p), and haven't tried it yet, but hopefully it will work ;).
 
Back
Top