Pixel-Wise Grayscale Masking in Post Process Material

I’m trying to achieve pixel-wise grayscale masking for a post-process material. I’ve been looking into custom depth masking, but it seems to only allow for masking of entire objects, rather than providing the fine-grained control I’m looking for.

What I’m trying to achieve is a situation where an object can have varying levels of brightness across its surface. For example, the bottom part of the object might be bright while the top part is dim.

As of now, I’m aware of the manual solution where one can change the material per object to achieve the desired effect. However, this approach is not feasible as it would require an impractical number of actors to be placed in the scene.

Has anyone come across a method to achieve pixel-wise grayscale masking within a post-process material?

Thank you in advance for your help!