Material Map from Vertex colors or Array

I create a landscape using Procedural Mesh. I have 2 arrays for this landscape -
TArray<int> HeightMap and TArray<uint8> MaterialMap.
Height map works good and i change geometry without problem. But i haven’t idea, how i can apply MaterialMap to my Landscape. I tried to set Vertices color and thought it was a good idea, but there is one prombel that i don’t know how to solve. If set material to each vertex as red channel from MaterialMap, we have a problem like at picture “A”.

But i need use vertex color without interpolation like at picture “B”. Or maybe is there other way to apply MaterialMap to procedural mesh?