Tiled texture masking

I have a big terrain mesh, which have a material with tiled texture on it. The uv unwrap of the terrain is just a plane. Is it possible to apply a image mask to specify where this tiled texture should appear on the terrain? Something like a weightmaps in ue4. Sorry for bad english.

Forgot to mention: this is in BGE.
Nevermind guys, figured it out myself: switched material to the nodes and then just used simple color mix between two different textures with my mask as factor input.