//function to take a noisemap and adjust a flat terrainmesh according to that map.
    public static MeshData GenerateTerrainMesh(Noise2D noisemap, float multiplier, AnimationCurve adjustment)
    {
        float topLeftX = (noisemap.Width - 1) / 2f;
        float topLeftZ = (noisemap.Height - 1) / 2f;
        //noisemap.GeneratePlanar();
        MeshData meshData    = new MeshData(noisemap.Width, noisemap.Height);
        int      vertexIndex = 0;

        for (int y = 0; y < noisemap.Height; y++)
        {
            for (int x = 0; x < noisemap.Width; x++)
            {
                meshData.vertices[vertexIndex] = new Vector3(x - topLeftX, adjustment.Evaluate(noisemap[x, y]) * multiplier, topLeftZ - y);
                meshData.uvs[vertexIndex]      = new Vector2(x / (float)noisemap.Width, y / (float)noisemap.Height);
                if (x < noisemap.Width - 1 && y < noisemap.Height - 1)
                {
                    meshData.AddTriangle(vertexIndex, vertexIndex + noisemap.Width + 1, vertexIndex + noisemap.Width);
                    meshData.AddTriangle(vertexIndex + noisemap.Width + 1, vertexIndex, vertexIndex + 1);
                }
                vertexIndex++;
            }
        }

        return(meshData);
    }
Beispiel #2
0
    public Texture2D GetCloudBase(UnityEngine.Gradient cloudGradient, int size, NoiseType type)
    {
        ModuleBase Generator = GetModule(type);
        //Billow Generator = new Billow(
        //    1f,
        //    2f,
        //    0.5f,
        //    6,
        //    Random.Range(0, int.MaxValue),
        //    QualityMode.Low);

        Noise2D map = new Noise2D(size, size / 2, Generator);

        map.GenerateSpherical(
            south,
            north,
            west,
            east);

        var tex = map.GetTexture(cloudGradient);

        tex.Apply();

        return(tex);
    }
Beispiel #3
0
    public void Generate()
    {
        // Create the module network
        ModuleBase moduleBase;

        switch (noise)
        {
        case NoiseType.Billow:
            moduleBase = new Billow();
            break;

        case NoiseType.RiggedMultifractal:
            moduleBase = new RiggedMultifractal();
            break;

        case NoiseType.Voronoi:
            moduleBase = new Voronoi();
            break;

        case NoiseType.Mix:
            Perlin             perlin = new Perlin();
            RiggedMultifractal rigged = new RiggedMultifractal();
            moduleBase = new Add(perlin, rigged);
            break;

        default:
            moduleBase = new Perlin();
            break;
        }

        // Initialize the noise map
        this.m_noiseMap = new Noise2D(resolution, resolution, moduleBase);
        this.m_noiseMap.GeneratePlanar(
            offset + -1 * 1 / zoom,
            offset + offset + 1 * 1 / zoom,
            offset + -1 * 1 / zoom,
            offset + 1 * 1 / zoom);

        // Generate the textures
        this.m_textures[0] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Grayscale);
        this.m_textures[0].Apply();

        this.m_textures[1] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Terrain);
        this.m_textures[1].Apply();

        this.m_textures[2] = this.m_noiseMap.GetNormalMap(3.0f);
        this.m_textures[2].Apply();

        //display on plane
        GetComponent <Renderer>().material.mainTexture = m_textures[0];


        //write images to disk
        File.WriteAllBytes(Application.dataPath + "/../Gray.png", m_textures[0].EncodeToPNG());
        File.WriteAllBytes(Application.dataPath + "/../Terrain.png", m_textures[1].EncodeToPNG());
        File.WriteAllBytes(Application.dataPath + "/../Normal.png", m_textures[2].EncodeToPNG());

        Debug.Log("Wrote Textures out to " + Application.dataPath + "/../");
    }
    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;
    }
    private void UpdateTexture()
    {
        texture.Resize(resolution.x, resolution.y);
        texture.wrapModeU           = wrapModeU;
        texture.wrapModeV           = wrapModeV;
        texture.alphaIsTransparency = true;
        texture.name = "Noise_" + name;

        if (seed == 0)
        {
            seed = Random.Range(int.MinValue, int.MaxValue);
        }

        ModuleBase noiseGenerator;

        switch (noiseType)
        {
        case NoiseType.Billow:
            Billow billow = new Billow(frequency, lacunarity, persistence, octaves, seed, QualityMode.High);
            noiseGenerator = billow;
            break;

        case NoiseType.RidgedMultifractal:
            RidgedMultifractal ridgedMultifractal = new RidgedMultifractal(frequency, lacunarity, octaves, seed, QualityMode.High);
            noiseGenerator = ridgedMultifractal;
            break;

        case NoiseType.Voronoi:
            Voronoi voronoi = new Voronoi(frequency, displacement, seed, distance);
            noiseGenerator = voronoi;
            break;

        default:
            //Default to perlin so the compiled doesn't complain
            Perlin perlin = new Perlin(frequency, lacunarity, persistence, octaves, seed, QualityMode.High);
            noiseGenerator = perlin;
            break;
        }

        Noise2D noiseMap = new Noise2D(resolution.x, resolution.y, noiseGenerator);

        noiseMap.GeneratePlanar(
            offset.x + -1 * 1 / zoom.x,
            offset.x + offset.x + 1 * 1 / zoom.x,
            offset.y + -1 * 1 / zoom.y,
            offset.y + 1 * 1 / zoom.y,
            isSeamless
            );
        Texture2D noiseTexture = noiseMap.GetTexture(colorGradient);

        Color32[] colorArray = noiseTexture.GetPixels32();
        texture.SetPixels32(0, 0, texture.width, texture.height, colorArray);
        texture.Apply();
        AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(texture));
        EditorUtility.SetDirty(this);
    }
Beispiel #6
0
    //  Other Functions
    //    ----------------------------------------------------------------------------


    void Generate()
    {
        Perlin myPerlin = new Perlin();

        ModuleBase myModule = myPerlin;



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

        // - Generate -

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


        Noise2D heightMap;

        heightMap = new Noise2D(mapSizeX, mapSizeY, myModule);

        heightMap.GeneratePlanar(
            sampleOffsetX,
            sampleOffsetX + sampleSizeX,
            sampleOffsetY,
            sampleOffsetY + sampleSizeY
            );


        //Debug.Log(cubeRenderer.material.mainTexture.name);
        texture = heightMap.GetTexture(LibNoise.Unity.Gradient.Grayscale);

        cubeRenderer.material.mainTexture = texture;
        //cubeRenderer.material.SetTexture("MainTexture", texture);
        texture.name = "noise";

        asteroidMaterial.mainTexture = texture;
        GetComponent <Renderer>().material.mainTexture = texture;
        GetComponent <Renderer>().material.SetTexture("_MainTexture", texture);

        /*
         *
         * mat.mainTexture = tex;
         * cubeRenderer.material = mat;
         *
         *
         * cubeRenderer.material.mainTexture = tex;
         * cubeRenderer.material.mainTexture.wrapMode = TextureWrapMode.Clamp;
         * tex.wrapMode = TextureWrapMode.Clamp;
         *
         * Color[] pixels = tex.GetPixels();
         *
         *
         *
         * cubeRenderer.material = asteroidMaterial;
         * asteroidMaterial.SetTexture("_MainTex", texture);*/
    }
 private static void AddNoise(Noise2D baseNoise, Noise2D additionNoise)
 {
     for (int i = 0; i < baseNoise.Width; i++)
     {
         for (int j = 0; j < baseNoise.Height; j++)
         {
             baseNoise[i, j] += additionNoise[i, j];
         }
     }
 }
    public void UpdateSphereMap()
    {
        MapDisplay display = FindObjectOfType <MapDisplay>();

        noiseMap = updatedMap;
        Debug.Log(latestTimeProcessRequested + "updating map");
        mapTexture = GetMapTexture(renderType, noiseMap);
        display.DrawMesh(SphereMagic.CreatePlanet(PlanetItterations, radius, baseModule, heightMultiplier, regions), mapTexture);
        noiseMapUpdateAvailable = false;
    }
Beispiel #9
0
 public TestGridInfoProvider(int xSize, int ySize, GridDensity density, bool hasWalls, int?seed = null)
 {
     _density     = density;
     _hasWalls    = hasWalls;
     _noise       = seed == null ? new Noise2D() : new Noise2D(seed.Value);
     XSize        = xSize;
     YSize        = ySize;
     MinPosition  = new Position(0, 0);
     Bounds       = new BoundsInt(MinPosition.x, MinPosition.y, 0, xSize, ySize, 1);
     _walkability = GenerateWalkabilityMatrix(xSize, ySize);
 }
    void RenderAndSetImage(ModuleBase generator)
    {
        var heightMapBuilder = new Noise2D(Width, Height, generator);

        heightMapBuilder.GeneratePlanar(Noise2D.Left, Noise2D.Right, Noise2D.Top, Noise2D.Bottom);
        // heightMapBuilder.GenerateSpherical(90, -90, -180, 180);
        // heightMapBuilder.GenerateCylindrical(-180, 180, -1, 1);
        var image = heightMapBuilder.GetTexture();

        GetComponent <Renderer>().material.mainTexture = image;
    }
Beispiel #11
0
    public void initNoiseMap()       //MMP
    // Create the module network
    {
        ModuleBase moduleBase = chooseModuleBase(noise);

        // Initialize the noise map
        this.m_noiseMap = new Noise2D(resolutionX, resolutionZ, moduleBase);

        initAltNoiseMap();
        initAltNoiseMap2();
    }
    private static void LayerNoise(Noise2D baseNoise, ModuleBase module)
    {
        Noise2D thisNoise = new Noise2D(baseNoise.Width, baseNoise.Height, module);

        thisNoise.GeneratePlanar(
            -1,
            1,
            -1,
            1, true);
        AddNoise(baseNoise, thisNoise);
    }
    void Start()
    {
        var perlin = new Perlin();

        var heightMapBuilder = new Noise2D(512, 256, perlin);

        heightMapBuilder.GenerateSpherical(_south, _north, _west, _east);

        var image = heightMapBuilder.GetTexture(_gradient);

        renderer.material.mainTexture = image;
    }
Beispiel #14
0
    void Start()
    {
        var rawPerlin = new Perlin();

        rawPerlin.OctaveCount = 6;
        rawPerlin.Frequency   = 3;
        var planarPerlin = new Noise2D(64, 64, rawPerlin);

        planarPerlin.GeneratePlanar(0, 1, 0, 1);
        ppnoise = planarPerlin.GetData();
        Debug.Log("Raw perlin:" + rawPerlin.GetValue(.5, .5, .5));
        Debug.Log("Projected perlin:" + ppnoise[1, 1]);
    }
Beispiel #15
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();
                }
            }
        }
Beispiel #16
0
    public void Generate()
    {
        // Create the module network
        ModuleBase moduleBase;

        moduleBase = chooseModuleBase(noise);

        // Initialize the noise map
        this.m_noiseMap = new Noise2D(resolutionX, resolutionZ, moduleBase);
        this.m_noiseMap.GeneratePlanar(
            offset + -1 * 1 / zoom,
            offset + offset + 1 * 1 / zoom,
            offset + -1 * 1 / zoom,
            offset + 1 * 1 / zoom);

        //Generate the textures
//		this.m_textures[0] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Grayscale);
//		this.m_textures[0].Apply();
//
//		//MMP experiment
//		this.m_noiseMap.GeneratePlanar(
//			-2.0, // * 0.0,
//		    -1.0,
//			-1.0 * 0.0,
//			1.0);  // WoRKS! phew! (makes adjacent tiles...)
//
//		// Generate the textures
//		Texture2D adjTex = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Grayscale);
//		adjTex.Apply();
//		File.WriteAllBytes(Application.dataPath + "/../GrayAdjLeftL.png", adjTex.EncodeToPNG() );
        // END MMP experiment


//		this.m_textures[1] = this.m_noiseMap.GetTexture(LibNoise.Unity.Gradient.Terrain);
//		this.m_textures[1].Apply();
//
//		this.m_textures[2] = this.m_noiseMap.GetNormalMap(3.0f);
//		this.m_textures[2].Apply();
//
//		//display on plane
//		renderer.material.mainTexture = m_textures[0];
//
//
//		//write images to disk
//		File.WriteAllBytes(Application.dataPath + "/../Gray.png", m_textures[0].EncodeToPNG() );
//		File.WriteAllBytes(Application.dataPath + "/../Terrain.png", m_textures[1].EncodeToPNG() );
//		File.WriteAllBytes(Application.dataPath + "/../Normal.png", m_textures[2].EncodeToPNG() );

//		Debug.Log("Wrote Textures out to "+Application.dataPath + "/../");
    }
Beispiel #17
0
    void RenderAndSetImage(ModuleBase generator)
    {
        var heightMapBuilder = new Noise2D(Noise.Width, Noise.Height, generator);

        heightMapBuilder.GeneratePlanar(Noise.xOrg, Noise.xOrg + 5, Noise.yOrg, Noise.yOrg + 5);
        var image = heightMapBuilder.GetTexture(Noise.Gradient);

        image.Apply();
        image.filterMode = FilterMode.Point;

        Sprite sprite = Sprite.Create(image, new Rect(0, 0, 64, 64), Vector2.zero, 32, 1);

        transform.GetComponent <SpriteRenderer>().sprite = sprite;
    }
    void Generate()
    {
        billowModule = new Billow();
        offsetModule = new Translate(0, 1, 0, billowModule);
        myModule     = new Turbulence(1, offsetModule);

        Noise2D heightMapBuilder = new Noise2D(terrain.Width, terrain.Height, myModule);

        heightMapBuilder.GenerateSpherical(-90, 90, -180, 180);

        weatherImage = heightMapBuilder.GetTexture();
        weatherImage.Apply();

        GetComponent <LODMaterial>().OurMaterial.SetTexture("_Weather", weatherImage);
    }
    public combinedHeightHeat(IMap heightMap, IMap heatMap, worldChunkSettings chunkSettings)
    {
        Const  black        = new Const(-1);
        Select heightselect = new Select(heightMap.GetCache(), black, heightMap.GetCache());

        heightselect.SetBounds(.5, 1, .2);
        this.combo = new Add(heatMap.GetCache(), heightselect);
        //Invert invert = new Invert(combo);

        Noise2D final = new Noise2D(chunkSettings.mapWidth, chunkSettings.mapHeight, combo);

        final.GeneratePlanar(chunkSettings.left, chunkSettings.right, chunkSettings.top, chunkSettings.bottom, isSeamless: true);
        combinedCache = new Cache(combo);
        noiseData     = final.GetData();
    }
    void Generate()
    {
        var generator = graph.GetGenerator();

        Noise2D map = new Noise2D(size, size / 2, generator);

        map.GenerateSpherical(
            south,
            north,
            west,
            east);

        ColorMap = map.GetTexture();
        ColorMap.Apply();
    }
 public void Dispose()
 {
     deactivated = true;
     if (NoisePlane != null)
     {
         NoisePlane.Dispose();
     }
     NoisePlane = null;
     Sampler.Dispose();
     blocks      = null;
     blocks_set  = null;
     blocks_is0  = null;
     blocks_type = null;
     SurfaceData = null;
 }
        static void test2D(string name, Noise2D noisef)
        {
            var data = new List <byte>();

            for (int y = 0; y < imgHeight; y++)
            {
                for (int x = 0; x < imgWidth; x++)
                {
                    var v = noisef((x + ox) * sx, (y + oy) * sy);
                    data.Add(toLuminosity(v));
                }
            }

            writeImage(name, imgWidth, imgHeight, data);
        }
Beispiel #23
0
    void GenerateOwnTests()
    {
        ModuleBase perlin  = new Perlin(1, 2, .5, 6, seed, QualityMode.Medium);
        ModuleBase voronoi = new Voronoi(Frequency, Displacement, seed, true);
        ModuleBase add     = new Add(perlin, voronoi);

        Terrace terrace = new Terrace(false, add);

        terrace.Add(0f);
        terrace.Add(one);
        terrace.Add(two);

        var perlinbuilder = new Noise2D(Size, Size / 2, perlin);

        perlinbuilder.GeneratePlanar(_left, _right, _top, _bottom);

        var voronoibuilder = new Noise2D(Size, Size / 2, voronoi);

        voronoibuilder.GeneratePlanar(_left, _right, _top, _bottom);

        var addbuilder = new Noise2D(Size, Size / 2, add);

        addbuilder.GeneratePlanar(_left, _right, _top, _bottom);

        var terracebuilder = new Noise2D(Size, Size / 2, terrace);

        terracebuilder.GeneratePlanar(_left, _right, _top, _bottom);

        var perlintex  = perlinbuilder.GetTexture(_gradient);
        var voronoitex = voronoibuilder.GetTexture(_gradient);
        var addtex     = addbuilder.GetTexture(_gradient);
        var terracetex = terracebuilder.GetTexture(_gradient);

        perlintex.Apply();
        voronoitex.Apply();
        addtex.Apply();
        terracetex.Apply();

        Perlin.material.SetTexture("_BaseMap", perlintex);
        Voronoi.material.SetTexture("_BaseMap", voronoitex);
        Mix.material.SetTexture("_BaseMap", addtex);
        Terrace.material.SetTexture("_BaseMap", terracetex);

        //Perlin.material.SetTexture("_BaseMap", perlinbuilder.GetTexture(_gradient));
        //Voronoi.material.SetTexture("_BaseMap", voronoibuilder.GetTexture(_gradient));
        //Mix.material.SetTexture("_BaseMap", addbuilder.GetTexture(_gradient));
        //Terrace.material.SetTexture("_BaseMap", terracebuilder.GetTexture(_gradient));
    }
    void RenderAndSetImage(ModuleBase generator, MeshRenderer rend)
    {
        var heightMapBuilder = new Noise2D(256, 256, generator);

        heightMapBuilder.GeneratePlanar(_left, _right, _top, _bottom);

        //heightMapBuilder.GenerateSpherical(
        //    south,
        //    north,
        //    west,
        //    east);

        var image = heightMapBuilder.GetTexture(_gradient);

        rend.material.SetTexture("_BaseMap", image);
    }
Beispiel #25
0
    public BrickTree(Vector3i resolution, Noise2D noise)
    {
        this.noise = noise;

        BrickDimensionX = (int)Math.Pow(2, resolution.x);
        BrickDimensionY = (int)Math.Pow(2, resolution.y);
        BrickDimensionZ = (int)Math.Pow(2, resolution.z);

        octree = new SafeOctree <Brick>(new Vector3(BrickDimensionX, BrickDimensionY, BrickDimensionZ), new Vector3i(0, 0, 0));

        BrickAndModX = BrickDimensionX - 1;
        BrickAndModY = BrickDimensionY - 1;
        BrickAndModZ = BrickDimensionZ - 1;

        pool = new BrickPool(resolution);
    }
    private void backgroundProcessing()
    {
        // Create the module network
        ModuleBase moduleBase;

        switch (noise)
        {
        case NoiseType.Billow:
            moduleBase = new Billow();
            break;

        case NoiseType.RidgedMultifractal:
            moduleBase = new RidgedMultifractal();
            break;

        case NoiseType.Voronoi:
            moduleBase = new Voronoi(frequency, displacement, seed, false);

            break;

        case NoiseType.Mix:
            Perlin perlin = new Perlin();
            var    rigged = new RidgedMultifractal();
            moduleBase = new Add(perlin, rigged);
            break;

        case NoiseType.Practice:
            var bill = new Billow();
            bill.Frequency = frequency;
            moduleBase     = new Turbulence(turbulence / 10, bill);
            break;



        default:
            var defPerlin = new Perlin();
            defPerlin.OctaveCount = perlinOctaves;
            moduleBase            = defPerlin;

            break;
        }

        // Initialize the noise map
        this.m_noiseMap = new Noise2D(resolution, resolution, moduleBase);

        m_noiseMap.GenerateSpherical(_north, _south, _west, _east);
    }
Beispiel #27
0
    public void cavegen()
    {
        mapWidth  = 64;
        mapHeight = 64;
        Vector2 centre = new Vector2(mapWidth / 2, mapHeight / 2);

        tiles = new TileType[mapWidth, mapHeight];

        var perlin = new Perlin();

        perlin.OctaveCount = _octaveCount;
        perlin.Frequency   = _frecuency;
        perlin.Persistence = _persistence;
        perlin.Seed        = UnityEngine.Random.seed;

        var heightMapBuilder = new Noise2D(mapHeight, mapWidth, perlin);

        heightMapBuilder.GeneratePlanar(_west, _east, _north, _south);

        var image = heightMapBuilder.GetTexture(_gradient);

        for (int y = 0; y < mapHeight; y++)     //Starts an itteration for all y coordinates
        {
            for (int x = 0; x < mapHeight; x++) //Starts an itteration of all x coordinates for the given y coordinate
            {
                //Creates a tile at the given location
                double e = image.GetPixel(x, y).grayscale;

                tiles[x, y] = CaveTileSelector(e, x, y, mapWidth, centre);
            }
        }

        setWallTiles(64, 64);

        tiles[mapWidth / 2, mapHeight / 2] = TileType.Entrance;

        placeTiles(64, 64);

        enemyCountRange = new IntRange(0, 4);
        createEnemies();

        mainGameLoc = new Vector2(32, 32);

        CurrentCamera.transform.position = new Vector3(32 * 1.28f, 32 * 1.28f, -10);
        nextCameraLoc = CurrentCamera.transform.position;
    }
Beispiel #28
0
 public void Dispose()
 {
     deactivated = true;
     //blocks = null;
     //SurfaceData = null;
     //BlockTypes = null;
     //AtlasUvs = null;
     //neighbors = null;
     if (NoisePlane != null)
     {
         NoisePlane.Clear();
         NoisePlane.Dispose();
     }
     NoisePlane  = null;
     NoiseModule = null;
     caveModule  = null;
 }
Beispiel #29
0
    private void fill(worldChunkSettings chunkSettings, heightMapSettings settings)

    {
        RidgedMultifractal baseMap = new RidgedMultifractal();

        baseMap.OctaveCount = settings.Octaves;
        baseMap.Frequency   = settings.Frequency;
        baseMap.Lacunarity  = settings.Lacunarity;
        baseMap.Seed        = settings.Seed;

        Perlin layer2 = new Perlin();

        layer2.OctaveCount = settings.Octaves;
        layer2.Frequency   = settings.Frequency;
        layer2.Lacunarity  = settings.Lacunarity;
        layer2.Seed        = settings.Seed;
        Billow controller = new Billow();

        controller.Frequency = settings.Frequency;
        Blend  blend    = new Blend(baseMap, layer2, controller);
        Invert invert   = new Invert(blend);         //makes heightmap more island like
        Clamp  oceanfix = new Clamp(-.7, 1, invert); //prevent ocean floor from being to low

        //Const black = new Const(-1);
        // holes in surface at top of mountains
        //Select holes = new Select(oceanfix, black, oceanfix);
        //holes.SetBounds(.85, 1, .01); //get highest elevation with little falloff
        this.heightCache = new Cache(oceanfix);

        var final = new Noise2D(chunkSettings.mapHeight, chunkSettings.mapWidth, oceanfix);

        //turbulance = new Turbulence(12, baseMap);
        final.GeneratePlanar(chunkSettings.left, chunkSettings.right, chunkSettings.top, chunkSettings.bottom, isSeamless: true);
        //final.GenerateSpherical(1, 3,1, 3);

        /*
         * for (int x=0; x<mapWidth; x++)
         * {
         *  for (int y=0;y<mapHeight;y++)
         *  {
         *      noiseData[x,y] = (float)(baseMap.GetValue(x,0,y));
         *  }
         * }
         */
        noiseData = final.GetData();
    }
    void ProcessTextures()
    ///summary
    ///This thread processes the textures
    ///incrementally in increasing resolutions.
    ///It uses abort checks that extend to
    ///the more computationaly intense parts
    ///of the code--halting and aborting threads
    ///that are no longer necessary mid process.
    {
        var processTimestamp = latestTimeProcessRequested;
        int count            = 0;

        //the crazyness in the for loop's i value is in order to allow it to be
        //used as a resolution manipulator without doing the math multiple times inside a loop

        for (int i = 16; i > 1; i = i / 2)
        {
            Debug.Log((count + 1) + " run start by " + processTimestamp);
            if (processTimestamp != latestTimeProcessRequested)
            {
                Debug.Log("Stopping Thread " + processTimestamp + " for thread " + latestTimeProcessRequested);
                drawInProgress = false;
                return;
            }
            if (i == 16)
            {
                reset = false;
            }
            count++;
            Noise2D placeHolder;
            Debug.Log("drawing map " + count + " by " + processTimestamp);
            placeHolder = new Noise2D(mapWidth / i, mapHeight / i, baseModule);
            placeHolder.GenerateSpherical(-90, 90, -180, 180, ref latestTimeProcessRequested, ref processTimestamp, ref reset);
            if (latestTimeProcessRequested != processTimestamp)
            {
                Debug.Log("Stopping Thread (2nd shallow catch)" + processTimestamp + " for thread" + latestTimeProcessRequested);
                drawInProgress = false;
                return;
            }
            Debug.Log("Map " + count + " drawn by " + processTimestamp);
            updatedMap = placeHolder;
            noiseMapUpdateAvailable = true;
        }
        Debug.Log("Thread Shutdown");
        drawInProgress = false;
    }
	private void setupMountainNoise(){

		p_mountainNoise = new PerlinNoise2D ();
		p_mountainNoise.Seed = mountainNoiseSeed;
		p_mountainNoise.Amplitude = mountainNoiseAmplitude;
		p_mountainNoise.Frequency = mountainNoiseFrequency;
		p_mountainNoise.Octave = mountainNoiseOctave;
		p_mountainNoise.AllowedNegative = false;

	}
	private void setupGroundNoise(){

		p_groundNoise = new PerlinNoise2D();
		p_groundNoise.Seed = groundNoiseSeed;
		p_groundNoise.Amplitude = groundNoiseAmplitude;
		p_groundNoise.Frequency = groundNoiseFrequency;
		p_groundNoise.Octave = groundNoiseOctave;
		p_groundNoise.AllowedNegative = true;

	}