ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Please add alpha channel support to ObservationWriter.WriteTexture

Open mbaske opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. Sometimes, ARGB32 render textures contain observable data in their alpha channel, for instance when using them with depth-normal texture shaders.

Describe the solution you'd like ObservationWriter.WriteTexture should handle alpha in addition to rgb. AFAIK, Texture.EncodeToPNG already supports alpha channels when compressing observations.

Describe alternatives you've considered Mapping the alpha channel to an additional texture's rgb channels.

mbaske avatar Jul 04 '21 10:07 mbaske

Hmm, the main reason we haven't done this is it's not standard on the Python/training side to have the Alpha channel as input to the CNN. Still, we do support more than 3 channels input for matrix observations (it encodes as multiple PNGs), maybe we can make a custom WriteTexture param that also includes the alpha fairly easily. cc: @dongruoping

ervteng avatar Jul 20 '21 23:07 ervteng

Yes it should be fairly straight forward to implement. For now to use ARGB textures, you can use compressed observations and it should work as-is, as long as you set the correct observation size in your sensor.

I've logged this request internally as MLA-2111.

dongruoping avatar Jul 22 '21 01:07 dongruoping