I know how to apply a simple linear/radial gradient to a mesh but what if I want more control over the gradient, let's say I want it to follow certain regions of a mesh? I posted two examples of what I mean:
Here a linear/radial gradient probably won't give me the desired results. Can I somehow paint a gradient manually or is there a more convenient method?

