Open up your Height map in GIMP or Photoshop and make sure it's set on RGB colour and it have to be 513x513 Pixles. Then you can draw your terrain mask over it using these colours:
R - 225, 0 ,0.
G - 0, 225, 0.
B - 0, 0, 225.
Then you can save it and use different textures for your map.