Its possible allright... but if you convert z to RGBA then its not true z depth! True zdepth is:
A) supposed to be antialiased (a point can not be in betewwn two spaces unless the objevcts actualy bleed into each other)
a loating point value. And is as a extra channel outside rgba.
C) the z buffer calculated in this manner is absolutely free from the renderers standpoint the data is just wirtten out to the file. Causes your pipe allmost no overhead whatsoever!
Use real z buffer its more accurate, read the sdk on how the data is stored in iff. Also read composition tuts they tell you how to circumvent the un antialiazed quantity of the z.
You can however easily make a shader That outputs the dpeth in RGBA foormat or any channel thereoff. its pertty simple. But it would be good if you knew the clippingplanes distance beforehand! To do this: just connect point camera Z to a set range node (adjust the set range to reflect how far you clipping planbe remevber forward is negative z so reflect this in you node, bevare the z depth is fickle, even inside comp softs that understand it!) is and connect the output to any channel of a surface shader. Then assign this to your texture. You are now forced to make one extra pass for this z data. Now while you render this extra pass you can feed any other info on the 3 remaining channels.
you can use the zdepth shader on this site as basis for this override shader!