public static string TerrainToString(LayerManager lm, List<Layer> layers)
    {
        StringBuilder sb = new StringBuilder();

        int x_min = lm.lt.globalTerrainC.definedArea.botLeft.x;
        int z_min = lm.lt.globalTerrainC.definedArea.botLeft.x;
        int x_max = lm.lt.globalTerrainC.definedArea.topRight.x;
        int z_max = lm.lt.globalTerrainC.definedArea.topRight.z;

        //Debug.Log(lm.rg.lt.tg.scaleTerrain);

        for (int x = x_min; x< x_max; x++)
        {
            for (int z = z_min; z < z_max; z++)
            {
                sb.Append(string.Format("v {0} {1} {2}\n", x, lm.GetValueFromLayers(x, z, layers) * lm.rg.lt.tg.scaleTerrain.y, z));
            }
        }

        sb.Append("\n");

        int w = x_max - x_min; //width
        int h = z_max - z_min; //height

        for (int x = 0; x < w - 1; x++)
        {
            for (int z = 0; z < h - 1; z++)
            {
                sb.Append(string.Format("f {0} {1} {2} {3}\n", x*h+z+1, x*h+z+2, x*h+h+z+2, x*h+h+z+1));
            }
        }

        return sb.ToString();
    }