Automate bit-packing multiple bakes for game engine textures

I’ve written myself a script to automate the baking process, and I’ve got it working to spit out base colour, normal, AO, metallic and roughness textures with a single click. yay!

but ideally I’d like to have it combine the ao, metallic and roughness into a single texture since they don’t require more than one colour channel each. I’m sure I could automate it in a photoshop action or something, but I figure it’d be really nice if I could roll it all into my one-click solution.

I couldn’t seem to see any simple python commands for remapping channels, so the options I’m considering are to have the script pipe ao, metal, roughness data into rgb channels at the material level, or to set up some sort of compositing nodes to combine the textures after the bake.

just curious if anyone has thoughts on what is the smartest approach for this type of problem?

Hey, exactly what i’m looking for. My bro is doing a project and i would like to help him coding that (and a webdev and he is a 3d artist)
have you ever published your script?

i’ll go back some evening and see where i ended up with that script back in the day and follow up here if i find it!