How to paint the Terrain with Materials instead of Textures

I want to paint my terrain with Materials instead of Textures. As of now, I have a Mastermaterial whichis the Ground of my terrain and now i’ ve added multiple layers of textures to paint my terrain. How can I paint my terrain with Materials