how to make a z-depth AND height pass? Struggling to work out how to make a depth AND height pass, so I can use them in compositing an animation of a city.

Depth is easy...height, not so...

Is there some way to mix a vertical gradient with a mist pass to get this result? Or is there a different way?

I am trying to get the effect of a denser mist at lower levels.

Let me know if i need to clarify further.
Basic idea : render additional layer with overriding material which assign a grayscale value based on the point height  , use this layer as height pass 

Details :

create the overriding material that will replace all materials in the height pass as follows :



setup an the height pass to use the override material :



in the compositor use the color output of the Height layer as a height pass :



after compositing here is the result :
no height :

 with height :