GeneratePlanar() private method

Generates a planar projection of a point in the noise map.
private GeneratePlanar ( float x, float y ) : float
x float The position on the x-axis.
y float The position on the y-axis.
return float
コード例 #1
0
ファイル: XNoise.cs プロジェクト: olivierh59500/DEMO
    /// <summary>
    /// Gets the height map data.
    /// </summary>
    /// <returns>The height map data.</returns>
    /// <param name="w">The width.</param>
    /// <param name="h">The height.</param>
    public override float[,] GetHeightmapData(int w, int h, int x, int z)
    {
        heightMapBuilder = new Noise2D(w, h, finalTerrain);
        heightMapBuilder.GeneratePlanar(left, right, top, bottom);

        return(heightMapBuilder.GetData());
    }
コード例 #2
0
    public void UpdateTerrainPreview()
    {
        Perlin baseNoise = new Perlin()
        {
            Frequency = _noiseFreq, Lacunarity = _noiseLac, OctaveCount = _noiseOct
        };

        if (_seed != "")
        {
            baseNoise.Seed = Convert.ToInt32(_seed);
        }
        else
        {
            baseNoise.Seed = UnityEngine.Random.Range(int.MinValue, int.MaxValue);
        }


        LibNoise.Noise2D noise2D = new LibNoise.Noise2D(_previewTex.width, baseNoise);

        float mOff = 0.01f;

        noise2D.GeneratePlanar(-1 - _mouseOffset.y * mOff, 1 - _mouseOffset.y * mOff, -1 - _mouseOffset.x * mOff, 1 - _mouseOffset.x * mOff);

        _previewTex = noise2D.GetTexture();
        _terDrawing = new EditorTerrainDrawing(_previewTex);
        _terDrawing.Update();


        _previewTex.Apply();
    }
コード例 #3
0
ファイル: XNoise.cs プロジェクト: olivierh59500/DEMO
    /// <summary>
    /// Gets the height map data.
    /// </summary>
    /// <returns>The height map data.</returns>
    /// <param name="w">The width.</param>
    /// <param name="h">The height.</param>
    public override float[,] GetHeightmapData(int w, int h, int x, int z)
    {
        heightMapBuilder = new LibNoise.Noise2D(w, h, perlinNoiseGenerator);
        heightMapBuilder.GeneratePlanar(left, right, top, bottom);

        return(heightMapBuilder.GetData());
    }
コード例 #4
0
	void RenderAndSetImage(ModuleBase generator)
	{
		var heightMapBuilder = new Noise2D(256, 256, generator);
		heightMapBuilder.GeneratePlanar(_left, _right, _top, _bottom);
		var image = heightMapBuilder.GetTexture(_gradient);
		renderer.material.mainTexture = image;
	}
コード例 #5
0
    private Texture2D texture; // texture created for testing

    #endregion Fields

    #region Methods

    public void Generate()
    {
        Perlin mySphere = new Perlin();
        mySphere.Seed = seedHandler.currentSeed;
        seedModifier = Random.Range(0,2048);
        mySphere.Seed = mySphere.Seed + seedModifier + specialSeedModifier; // modify the seed with the variable declared in the editor (default 0, or no change)

        mySphere.OctaveCount = octaves;
        // modify the frequency
        mySphere.Frequency = frequency;
        // modify the persistence
        mySphere.Persistence = persistence;
        // ------------------------------------------------------------------------------------------

        // - Compiled Terrain -

        Debug.LogError ("Not fetching seed data for planets!");
        ModuleBase myModule;

        myModule = mySphere;

        // ------------------------------------------------------------------------------------------

        // - Generate -

        // this part generates the heightmap to a texture,
        // and sets the renderer material texture of a sphere to the generated texture

        Noise2D heightMap;

        heightMap = new Noise2D( mapSizeX, mapSizeY, myModule );
        heightMap.GeneratePlanar(
            sampleOffsetX,
            sampleOffsetX + sampleSizeX,
            sampleOffsetY,
            sampleOffsetY + sampleSizeY
            );
        heightMap.GenerateSpherical( south, north, west, east );
        potentialRandomGradiants = Random.Range (0,3);
        if(potentialRandomGradiants == 0){
            texture = heightMap.GetTexture(GradientPresets.nebulaColorsD);

        }
        else if(potentialRandomGradiants == 1){

            texture = heightMap.GetTexture(GradientPresets.nebulaColorsD);
        }
        else if(potentialRandomGradiants == 2){
            texture = heightMap.GetTexture(GradientPresets.nebulaColorsD);

        }
        else {
            texture = heightMap.GetTexture(GradientPresets.nebulaColorsD);

        }
        //nebulaColorsB, C, A, D
        sphereRenderer.material.mainTexture = texture;
    }
コード例 #6
0
    void RandomizeTerrainHeights()
    {
        int noiseSeed   = Random.Range(0, int.MaxValue);
        var noiseMap    = new LibNoise.Noise2D(m_TerrainData.heightmapWidth, m_TerrainData.heightmapHeight);
        var noiseModule = new LibNoise.Generator.Perlin();

        // Configure the noise parameters
        noiseModule.OctaveCount = 20;
        noiseModule.Persistence = 0.45f;
        noiseModule.Seed        = noiseSeed;
        noiseMap.Generator      = noiseModule;

        // Generate the noise map
        noiseMap.GeneratePlanar(-1.5f, 1.5, -1.5, 1.5f, true);

        // Get a two-dimensional array of heights from the noise map
        float borderHeight = m_TerrainBorderHeight / m_TerrainData.size.y;

        float[,] heights = noiseMap.GetData();

        // Loop through every "pixel" and set the height to a random value
        for (int x = 0; x < m_TerrainData.heightmapWidth; x++)
        {
            for (int y = 0; y < m_TerrainData.heightmapHeight; y++)
            {
                // Divide the height by 2 so it doesn't flow over the top of the arena
                heights[x, y] /= 2f;

                // Fill in flat areas with random noise
                if (heights[x, y] <= borderHeight &&
                    heights[x, y] >= borderHeight / 2)
                {
                    float newHeight = Random.Range(0f, borderHeight / 2);
                    heights[x, y] = Mathf.Lerp(heights[x, y], newHeight, 0.5f);
                }

                // Update the maxHeight variable if the current height point breaks the previous record
                if (heights[x, y] > m_MaxHeight)
                {
                    m_MaxHeight = heights[x, y];
                }
            }
        }

        // Debug.Log("Max Height: " + m_MaxHeight);

        // Store the result back into terrainData
        m_TerrainData.SetHeights(0, 0, heights);
    }
コード例 #7
0
	void Start()
	{
		var perlin = new Perlin();
		// Unlike on the base LibNoise tutorial, we don't have a separate heightMap target
		// to set - we will instead build it after.  We also initialize the resulting size
		// on the constructor instead of passing a separate destination size.
		var heightMapBuilder = new Noise2D(256, 256, perlin);
		heightMapBuilder.GeneratePlanar(_left, _right, _top, _bottom);

		// Get the image
		var image = heightMapBuilder.GetTexture(_gradient);

		// Set it. It may appear inverted from the example on the LibNoise site depending 
		// on the angle at which the object is rotated/viewed.
		renderer.material.mainTexture = image;

		// We don't do the light changes for the texture, since that's beyond the scope of 
		// this port
	}
コード例 #8
0
    private Texture2D texture; // texture created for testing

    #endregion Fields

    #region Methods

    public void Generate()
    {
        Perlin mySphere = new Perlin();
        mySphere.Seed = seedHandler.currentSeed;
        seedModifier = Random.Range(0,2048);
        mySphere.Seed = mySphere.Seed + seedModifier + specialSeedModifier; // modify the seed with the variable declared in the editor (default 0, or no change)

        mySphere.OctaveCount = octaves;
        // modify the frequency
        mySphere.Frequency = frequency;
        // modify the persistence
        mySphere.Persistence = persistence;

        // ------------------------------------------------------------------------------------------

        // - Compiled Terrain -
        ModuleBase myModule;

        myModule = mySphere;

        // ------------------------------------------------------------------------------------------

        // - Generate -

        // this part generates the heightmap to a texture,
        // and sets the renderer material texture of a sphere to the generated texture

        Noise2D heightMap;

        heightMap = new Noise2D( mapSizeX, mapSizeY, myModule );
        heightMap.GeneratePlanar(
            sampleOffsetX,
            sampleOffsetX + sampleSizeX,
            sampleOffsetY,
            sampleOffsetY + sampleSizeY
            );
        heightMap.GenerateSpherical( south, north, west, east );
        //Somewhere this is f*****g up
        texture = heightMap.GetTexture(GradientPresets.nebulaColorsB);
        sphereRenderer.material.mainTexture = texture;
    }
コード例 #9
0
    void Start()
    {
        // defines noise type
        NoiseSelector();

        // setup terrain data
        TerrainData terrain = Terrain.activeTerrain.terrainData;
        int hmArea = terrain.heightmapWidth;
        float[,] heightmapData = terrain.GetHeights(0, 0, hmArea, hmArea);

        // create the noise map
        Noise2D noiseMap = new Noise2D(maxArea, maxArea, generate);
        noiseMap.GeneratePlanar(0, maxArea, 0, maxArea);

        // send noise to texture
        Texture2D textMap = noiseMap.GetTexture(_gradient);

        // texture data to heightmap
        for (int y = 0; y < hmArea; y++)
        {
            for (int x = 0; x < hmArea; x++)
            {
                heightmapData[y, x] = textMap.GetPixel(x, y).grayscale;
            }
        }

        // set terrain heights from heightmap data
        terrain.SetHeights(0, 0, heightmapData);
    }
コード例 #10
0
        void DrawSelectedNodeDetails(NodeBase node)
        {
            if (previewNeedsUpdate || lastSelected != node)
            {
                preview = new Texture2D(230, 230);
                if (node.Module != null && previewCalculation == null)
                    previewCalculation = new NoiseCalculation(node.Module, 230, 230);
                previewNeedsUpdate = false;
                lastSelected = node;
            }

            if (previewCalculation != null && previewCalculation.Done)
            {
                preview = previewCalculation.Noise.GetTexture();
                previewCalculation = null;
            }

            var state = mainEditorState as NoiseDesignerState;

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Selected Node:");
            GUILayout.Box(preview);
            EditorGUILayout.Space();
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Apply to terrain:");
            terrain = EditorGUILayout.ObjectField("TerrainData", terrain, typeof(TerrainData), false) as TerrainData;
            if (GUILayout.Button("Apply"))
            {
                Noise2D noise = new Noise2D(terrain.heightmapWidth, terrain.heightmapHeight, node.Module);
                noise.GeneratePlanar(4.0f, 10.0f, 1.0f, 5.0f);
                terrain.SetHeights(0, 0, noise.GetNormalizedData());
            }
            EditorGUILayout.Space();
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Export as texture:");
            state.textureSize = EditorGUILayout.Vector2Field("Texture Size", state.textureSize);
            if (GUILayout.Button("Save as PNG"))
            {
                var path = EditorUtility.SaveFilePanelInProject("Save as PNG", "noise", "png", "");
                if (!string.IsNullOrEmpty(path))
                {
                    Noise2D noise = new Noise2D((int)state.textureSize.x, (int)state.textureSize.y, node.Module);
                    noise.GeneratePlanar(4.0f, 10.0f, 1.0f, 5.0f);
                    var texture = noise.GetTexture();
                    File.WriteAllBytes(path, texture.EncodeToPNG());
                    AssetDatabase.Refresh();
                }
            }
        }
コード例 #11
0
	public override void sceneEvents(SceneView sceneview){
		if(teNoisePaint==false){return;}
		if(Event.current.type==EventType.MouseDown){
			Ray ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition);
			RaycastHit hit = new RaycastHit();
			if(Physics.Raycast(ray, out hit, 7000.0f)){
				GameObject go = hit.collider.gameObject;
				TerrainData td = go.GetComponent<Terrain>().terrainData;
				Undo.RegisterUndo(td,"Paste Noise");
				int x = (int)hit.point.x - (int)go.transform.position.x;
				int z = (int)hit.point.z - (int)go.transform.position.z;
				int heightres = td.heightmapResolution;
				float heightMult = (1.0f / td.size.x)*(float)heightres;
				int heiX = ((int)(heightMult*(float)x))+heightres; //x:z coords for other map resolutions
				int heiZ = ((int)(heightMult*(float)z))+heightres;
				Event.current.Use();
				heights = TerrainEdge.getNeighborhoodHeights(go);
				float strengthmult =1.0f;
				int channelId = teNoiseChanIndex;
				Vector3 gopos = go.transform.position;
		        float cwidth = go.GetComponent<Terrain>().terrainData.size.x;
		        yoffset = (1f) - (gopos.x / cwidth);
		        xoffset = (-1f) + (gopos.z / cwidth);
		        tmpNoiseMap = new Noise2D(heightres*3, heightres*3, moduleBase[channelId]);
		        tmpNoiseMap.GeneratePlanar(xoffset, xoffset + (1f / heightres) * (heightres*3) + 3, -yoffset, -yoffset + (1f / heightres) * (heightres*3) + 3);
		        tmpTexture = tmpNoiseMap.GetTexture();
		        tmpTexture.Apply();
	        	int pasteregionoffset = (int)((float)teNoiseBrushSize);
				for(int paintZ=(heiZ)-pasteregionoffset;paintZ<(heiZ)+(pasteregionoffset+1);paintZ++){
					for(int paintX=(heiX)-pasteregionoffset;paintX<(heiX)+(pasteregionoffset+1);paintX++){
						if(paintZ>=0&&paintZ<=(heightres*3)-2&&paintX>=0&&paintX<=(heightres*3)-2){
							strengthmult = falloffMult(paintX,heiX,paintZ,heiZ,pasteregionoffset);
							float tmpval = (tmpNoiseMap[paintZ, paintX] + 0.5f) * noiseAmp;
							if(heights[paintZ,paintX]>tmpval){ 
								heights[paintZ,paintX]-=(heights[paintZ,paintX]-tmpval) * strengthmult;
							} else {
								heights[paintZ,paintX]+=(tmpval-heights[paintZ,paintX]) * strengthmult;
							}
						}
					}
				}
				TerrainEdge.setNeighborhoodHeights(go,heights);
			}
		}
	}
コード例 #12
0
ファイル: Chunk.cs プロジェクト: hybrid1969/UCN-Sem5-2014
    void GenerateHeightmap(BiomeTypes[,] biomes)
    {
        int resolution = ThisTerain.terrainData.heightmapResolution;
        Heightmap = new float[resolution, resolution];
        List <LibNoise.ModuleBase> modules = new List<ModuleBase>();
        for (int i = 0; i < availblebiomes.Count; i++)
        {
            if (!modules.Contains(Biome.FindBiome(availblebiomes[i]).Generate(noisehelper)))
            {
                modules.Add(Biome.FindBiome(availblebiomes[i]).Generate(noisehelper));
            }
        }
        
        for (int i = 1; i < modules.Count; i++)
        {
            if (modules[i] != null)
            {
                modules[i][0] = modules[i - 1];
            }
        }
        Noise2D heightMap = new Noise2D(resolution, resolution, modules[0]);
        heightMap.GeneratePlanar(yOffset, yOffset + 1.0f, xOffset, xOffset + 1.0f);

        for (int y = 0; y < resolution; y++)
        {
            for (int x = 0; x < resolution; x++)
            {
                Heightmap[x, y] = (((heightMap[x, y]) * 0.5f) + 0.5f);// (float)((FlatNoiseMap[x, y] * 0.5f) + 0.5f);
            }
        }

        ThisTerain.terrainData.SetHeights(0, 0, Heightmap);
        ThisTerain.Flush();
    }
コード例 #13
0
ファイル: Chunk.cs プロジェクト: hybrid1969/UCN-Sem5-2014
    void GenerateBiomes()
    {
        int resolution = ThisTerain.terrainData.alphamapResolution;

        Noise2D heightMap = new Noise2D(resolution, resolution, new Perlin(0.125, 2, 0.5, 10, DataBaseHandler.DataBase.Seed, QualityMode.High));
        heightMap.GeneratePlanar(yOffset, yOffset + 1.0f, xOffset, xOffset + 1.0f);

        Noise2D rainfall = new Noise2D(resolution, resolution, new Perlin(0.125, 2, 0.5, 10, DataBaseHandler.DataBase.Seed, QualityMode.High));
        rainfall.GeneratePlanar(yOffset, yOffset + 1.0f, xOffset, xOffset + 1.0f);

        Humidity = new float[ThisTerain.terrainData.alphamapResolution, ThisTerain.terrainData.alphamapResolution];
        biomes = new BiomeTypes[ThisTerain.terrainData.alphamapResolution, ThisTerain.terrainData.alphamapResolution];
        Temperature = new float[ThisTerain.terrainData.alphamapResolution, ThisTerain.terrainData.alphamapResolution];

        for (int i = 0; i < ThisTerain.terrainData.alphamapResolution; i++)
        {
            for (int j = 0; j < ThisTerain.terrainData.alphamapResolution; j++)
            {
                Temperature[i, j] = -50.0f + (((((heightMap[i, j] * 0.5f) + 0.5f) + (CosGradient(i + (yOffset * (float)(resolution)), (float)(resolution), 0.25f) * 0.5f) + 0.5f) / 2.0f) * 100.0f);
                Humidity[i, j] = ((((CosGradient(i + (yOffset * (float)(resolution)), (float)(resolution), 0.25f) * 0.5f) + 0.5f)) * 100.0f) * (((rainfall[i, j] * 0.5f) + 0.5f));
                //Humidity[i, j] = ((((rainfall[i, j] * 0.5f) + 0.5f)) * 100.0f);// *(((((heightMap[i, j] * 0.75f) + 0.5f) + (CosGradient(i + (yOffset * (float)(resolution)), (float)(resolution), 0.5f) * 0.25f) + 0.5f) / 2.0f));
                //Old Biome Selector
                //biomes[i, j] = DataBaseHandler.DataBase.BiomeDiagram[Mathf.RoundToInt((((heightMap[i, j] * 0.5f) + 0.5f) + (CosGradient(i + (yOffset * (float)(resolution)), (float)(resolution), 0.5f) * 0.5f) + 0.5f) / 2), Mathf.RoundToInt((RainShadow[i, j] + ((rainfall[i, j] * 0.5f) + 0.5f) / 2) * 2)];
                biomes[i, j] = Biome.DecideBiome(Temperature[i, j], Humidity[i, j]);
                if (!availblebiomes.Contains(biomes[i, j]))
                {
                    availblebiomes.Add(biomes[i, j]);
                }
            } //tmpNoiseMap.GeneratePlanar(xoffset, (xoffset) + (1f / resolution) * (resolution + 1), -yoffset, (-yoffset) + (1f / resolution) * (resolution + 1));

		}
    }
コード例 #14
0
ファイル: Chunk.cs プロジェクト: hybrid1969/UCN-Sem5-2014
    void GenerateRainShadow()
    {
        RainShadow = new float[ThisTerain.terrainData.alphamapResolution, ThisTerain.terrainData.alphamapResolution];

        Noise2D RainCalcMap = new Noise2D((DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2)), (DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2)), new Perlin(0.125, 2, 0.5, 10, DataBaseHandler.DataBase.Seed, QualityMode.High));
        RainCalcMap.GeneratePlanar(xOffset - ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), (xOffset + 1) + ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), yOffset - ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), (yOffset + 1) + ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize));

        for (int i = -MaxWindSpeed; i < RainCalcMap.Width - MaxWindSpeed; i++)
        {
            for (int j = -MaxWindSpeed; j < RainCalcMap.Height - MaxWindSpeed; j++)
            {
                if (RainCalcMap[i + MaxWindSpeed, j + MaxWindSpeed] <= 0.5f)
                {
                    Bresenham(i, i + (int)(WindDirection[j + MaxWindSpeed, i + MaxWindSpeed].x * MaxWindSpeed), j, j + (int)(WindDirection[j + MaxWindSpeed, i + MaxWindSpeed].y * MaxWindSpeed));
                }
            }
        }
    }
コード例 #15
0
ファイル: Chunk.cs プロジェクト: hybrid1969/UCN-Sem5-2014
    void GenerateWind()
    {
        Noise2D WindMap = new Noise2D((DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2)), (DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2)), new Perlin(0.125, 2, 0.5, 10, DataBaseHandler.DataBase.Seed, QualityMode.High));
        WindMap.GeneratePlanar(yOffset - ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), (yOffset + 1) + ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), xOffset - ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize), (xOffset + 1) + ((double)MaxWindSpeed / (double)DataBaseHandler.BiomeMapSize));

        WindDirection = new Vector2[(DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2)), (DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2))];
        for (int i = 0; i < DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2); i++)
        {
            for (int j = 0; j < DataBaseHandler.BiomeMapSize + (MaxWindSpeed * 2); j++)
            {
                float val = ((((CosGradient((i - 50) + (yOffset * (float)(DataBaseHandler.BiomeMapSize)), (float)(DataBaseHandler.BiomeMapSize), 0.125f) * 0.5f) + 0.5f) + (((WindMap[i, j]) * 0.5f) + 0.5f) / 2) * 12.0f);
                if (val >= 0 && val < 2)
                {
                    if (val >= 1)
                    {
                        WindDirection[i, j] = new Vector2(-1.0f, (val - 2.0f));
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2(val * -1.0f, -1.0f);
                    }
                }
                else if (val >= 2 && val < 4)
                {
                    if (val >= 3)
                    {
                        WindDirection[i, j] = new Vector2((4.0f - val), 1.0f);
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2(1.0f, val - 2.0f);
                    }
                }
                else if (val >= 4 && val < 6)
                {
                    if (val >= 5)
                    {
                        WindDirection[i, j] = new Vector2(-1.0f, (val - 6.0f));
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2((val - 4.0f) * -1.0f, -1.0f);
                    }
                }
                else if (val >= 6 && val < 8)
                {
                    if (val >= 7)
                    {
                        WindDirection[i, j] = new Vector2(val - 8.0f, 1.0f);
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2(-1.0f, (val - 6.0f));
                    }
                }
                else if (val >= 8 && val < 10)
                {
                    if (val >= 9)
                    {
                        WindDirection[i, j] = new Vector2(1.0f, (10.0f - val) * -1.0f);
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2((val - 8.0f), -1.0f);
                    }
                }
                else if (val >= 10 && val <= 12)
                {
                    if (val >= 11)
                    {
                        WindDirection[i, j] = new Vector2((val - 12.0f), 1.0f);
                    }
                    else
                    {
                        WindDirection[i, j] = new Vector2(-1.0f, (val - 10.0f));
                    }
                }
            }
        }
    }
コード例 #16
0
ファイル: teFunc.cs プロジェクト: hybrid1969/UCN-Sem5-2014
		public static void generateHeightmap(GameObject terrObject, ModuleBase modbase, float alphaAmount, float noiseAmp){
			Vector3 gopos = terrObject.transform.position;
	        float cwidth = terrObject.GetComponent<Terrain>().terrainData.size.x;
	        int resolution = terrObject.GetComponent<Terrain>().terrainData.heightmapResolution;
			float[,] hmap = new float[resolution,resolution];
	        double yoffset = 0 - (gopos.x / cwidth);
	        double xoffset = (gopos.z / cwidth);
	        Noise2D tmpNoiseMap = new Noise2D(resolution, resolution, modbase);
	        tmpNoiseMap.GeneratePlanar(xoffset, (xoffset) + (1f / resolution) * (resolution + 1), -yoffset, (-yoffset) + (1f / resolution) * (resolution + 1));
	        if (alphaAmount == 1.0f)
	        {
	            for (int hY = 0; hY < resolution; hY++)
	            {
	                for (int hX = 0; hX < resolution; hX++)
	                {
	                    hmap[hX, hY] = ((tmpNoiseMap[hX, hY]*0.5f) + 0.5f) * noiseAmp;
	                }
	            }
	        }
	        else
	        {
	            hmap = terrObject.GetComponent<Terrain>().terrainData.GetHeights(0, 0, resolution, resolution);
	            for (int hY = 0; hY < resolution; hY++)
	            {
	                for (int hX = 0; hX < resolution; hX++)
	                {
	                    hmap[hX, hY] = ((1.0f - alphaAmount) * hmap[hX, hY]) + (alphaAmount * (((tmpNoiseMap[hX, hY]*0.5f) + 0.5f) * noiseAmp));
	                }
	            }
	        }
	        terrObject.GetComponent<Terrain>().terrainData.SetHeights(0, 0, hmap);
	    }