Write Z-map into part of alpha channel

Hi BlenderArtists,

I’m working on an isometric game where 2d sprites can be partially masked by each other

For game optimization purposes, i’d like to save my mesh’s Z-map into its sprite’s alpha channel, but as I also would like to keep antialiasing informations, i’m searching how to make those infos coexist in a single channel

(I only need a small resolution for z, i guess 2 bits would be precise enough)

Did you ever heard about a similar approach ?
Would you advise me to re-encode those maps after the rendering process or is there any technics to reroute blender’s rendering engine to do so ? (I’m still new to Python)

I’d be grateful for any advice, thanks

Loupv

Nevermind, i’ll go for an other solution with two separate sprites…

If you ever come back to this, I suggest you take a look at the compositor. It is easy to remap some 2D information, like a Z map, to the final image’s alpha channel. Probably better than doing it in Python.