private void CreateGuiControls()
        {
            var panel = SampleFramework.AddOptions("Terrain");

            // TerrainMaterialLayer.BlendRange controls how fast one layer fades out.
            SampleHelper.AddSlider(
                panel, "Blend range", null, 0, 1,
                _terrainTile.Layers.OfType <TerrainMaterialLayer>().First().BlendRange,
                value =>
            {
                foreach (var materialLayer in _terrainTile.Layers.OfType <TerrainMaterialLayer>())
                {
                    materialLayer.BlendRange = value;
                }

                _terrainTile.Invalidate();
            });

            // TerrainMaterialLayer.BlendThreshold defines the threshold value for the blend texture.
            // Layers are drawn where their blend texture value is greater than the threshold.
            // Changing the threshold value can be used, for example, to decrease/increase the snow cover.
            SampleHelper.AddSlider(
                panel, "Snow blend threshold", null, -1, 1,
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendThreshold,
                value =>
            {
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendThreshold = value;
                _terrainTile.Invalidate();
            });

            // The TerrainMaterialLayer with the rock texture contains a height map. The height values
            // can be used to modify the blending, e.g. to show more gravel in the creases of the rock.
            SampleHelper.AddSlider(
                panel, "Rock height influence", null, -1, 1,
                ((TerrainMaterialLayer)_terrainTile.Layers[1]).BlendHeightInfluence,
                value =>
            {
                ((TerrainMaterialLayer)_terrainTile.Layers[1]).BlendHeightInfluence = value;
                _terrainTile.Invalidate();
            });

            // The layer blending can be modified by noise to make the transition borders irregular.
            SampleHelper.AddSlider(
                panel, "Snow noise influence", null, 0, 1,
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendNoiseInfluence,
                value =>
            {
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).BlendNoiseInfluence = value;
                _terrainTile.Invalidate();
            });
            SampleHelper.AddSlider(
                panel, "Snow noise tile size", null, 1, 100,
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).NoiseTileSize,
                value =>
            {
                ((TerrainMaterialLayer)_terrainTile.Layers[2]).NoiseTileSize = value;
                _terrainTile.Invalidate();
            });

            SampleFramework.ShowOptionsWindow("Terrain");
        }