Hi @Ianaken!
I believe what you are looking for is Height Lerp- which has conveniently been packaged up as an engine-provided Material Function. This is a pretty common way to achieve this exact effect.
Here’s a tutorial that goes into how to set up this MF:
Let me know if you have any other questions!