I also wanted to add an additional experimentation with normalizing the z-depth pass to use as a limiter effect for mask inputs. The ColorLookup node alpha curve can further finesse the z-depth gradient. The Grade node is a little harder on z-depth smooth transitions from black to white. The ColorLookup node generates a softer transition going from Black to Greyscale to White when chained together with the Grade node. You my not need the Grade node at all and just pipe directly in to ColorLookup node for less cpu processing.