How to set Terrain Materials?

I am working on a small procedural world system. Achived generating terrain with the help of Perlin Noise functions. Now it is needed to paint materials onto the terrain.

After trying several days i am at a point where i don´t have any new ideas how to achive this.
I wasn´t even able to set the defaultTerrainMaterial.

So i have several questions:

How to attach a material to to the terrain globally like setting the DefaultTerrainMaterial?

How to change/load a texture in materials?

How to paint materials onto the terrain (with the help of layers?)?
Something like PaintMaterialToTerrain (int LayerID, IMaterial pMaterial, int SectorX, int SectorY, float fOpacity) is needed. I think there is no function like “PaintMaterialToTerrain”, so i would create one, but i have no clue where to start.

Of course this should only be done by c++ code;

Hi @VadersApp

I’ve added a request for c++ code samples documenting these features and will report back here when they’re available.