How to solve this problem with shaders?

How to solve this problem with shaders?