Assuming you want to put in shadows for
anything up there, including overhead gantries you might have built up there out from nearby staircase stacks or between the peaks of various hills you may have fortified round, technically as far as the sky goes.
Though I'd suggest that shadow should only exist on the ground if, for every Z above the ground that an obstruction is, it has an equal X and Y spreading. A simple search up the Z stack and then out in ±X and ±Y should reveal what (if anything) might justify occultation. A narrow line of aerial flooring passing several Z over won't because the shadow diffuses/the sky illuminates round.
(Hard shadows that move according to the movements of the sun would be interesting, especially giving the opportunity to create a
sundial, but it wouldn't work well in fortress mode, and you'd only see the effects when adventuring. So probably not worth troubling over.)
For trees, this would mean very little (if any) leaf-shadow for slender trees (thinking of Minecraft firs,vas a visual aid), but anything billowy and lower would at least have a tile or two of shodow surrounding the trunk base.
For my part, though, I don't see it as necessary for trees alone, just "anything up there" rendering, a continuation of what even vanilla uses when you're (for example) Z-scrolling up and down a dug-out pit of great depth with bridges traversing across various levels within it, some "sky" tiles in the middle (X, Y
and Z) rendering differently according to what might be several Zs away. Just apply the same flavouring to ground graphics as well.
'Just'. SMOP.