Shading a material based on height

I have map having dynamically spawned actors of different sizes.

I want to create a material so that the lower parts of the material are of a different shade compared to the higher parts of the material. I tried using absoluteworldposition node but couldn’t achieve it.

You’d need to also take the object position into account.
Try something like this: