Ejemplo n.º 1
0
    void Start()
    {
        //Init objects.
        chunks         = new Dictionary <Vector2Int, GameObject>();
        blockChanges   = new Dictionary <Vector2Int, Dictionary <Vector3Int, int> >();
        toBeLoaded     = new Queue <Vector2Int>();
        toBeDeleted    = new Queue <Vector2Int>();
        player         = GameObject.FindGameObjectWithTag("Player");
        noiseGenerator = new SimplexNoiseGenerator();

        playerChunkLoc = Vector2Int.zero;

        //On Start, build chunk objects/block data out to the render distance.
        for (int x = -renderDistance; x < renderDistance; x++)
        {
            for (int z = -renderDistance; z < renderDistance; z++)
            {
                chunks.Add(new Vector2Int(x, z), buildChunkData(x, z));
            }
        }

        //Then, have those chunks build their meshes from block data.
        for (int x = -renderDistance; x < renderDistance; x++)
        {
            for (int z = -renderDistance; z < renderDistance; z++)
            {
                chunks[new Vector2Int(x, z)].GetComponent <TerrainChunk>().buildMesh();
            }
        }
    }
 /// <summary>
 /// InitializePlot all required simplex noises
 /// </summary>
 private void InitializeSimplexNoiseGenerators()
 {
     sngConstantWind             = new SimplexNoiseGenerator();
     sngWindGust                 = new SimplexNoiseGenerator();
     sngWindDirectionFluctuation = new SimplexNoiseGenerator();
     sngAttitudeDisturbances     = new SimplexNoiseGenerator();
 }
Ejemplo n.º 3
0
        public SimplexDensityFunction(float delta, float magnification)
        {
            _delta         = delta;
            _magnification = magnification;

            _noise = new SimplexNoiseGenerator(Environment.TickCount);
        }
Ejemplo n.º 4
0
    IEnumerator GenerateTerrain()
    {
        float t = Time.time;

        yield return(new WaitForEndOfFrame());

        SimplexNoiseGenerator sng = new SimplexNoiseGenerator(seed);
        BinaryImage           bi  = new BinaryImage(tex.width, tex.height, false);

        for (int x = 0; x < tex.width; x++)
        {
            float height = sng.coherentNoise(x / terrainStretch + (transform.position.x * terrainStretch), 0, 0, 1, 200, 1.75f, 2f, 0.9f);
            height += sng.coherentNoise(x / terrainStretch + (transform.position.x * terrainStretch), 0, 0, 2, 25, 0.05f, 2f, 0.9f);
            height += sng.coherentNoise(x / terrainStretch + (transform.position.x * terrainStretch), 0, 0, 1, 25, 0.1f, 2f, 0.9f);
            for (int y = 0; y < tex.height; y++)
            {
                if (y < height * tex.height + 500)
                {
                    bi.Set(x, y, true);
                }
                else
                {
                    break;
                }
            }
        }
        binaryImage = bi;
        binaryImage = tidyBinaryImage(binaryImage);
        updateCollider();
        Debug.Log((Time.time - t) * 1000f);
    }
Ejemplo n.º 5
0
 public LayerGenerator(int planetScale, BlockLayerInfo info, Entity entity, SimplexNoiseGenerator noiseGen)
 {
     this.planetScale = planetScale;
     this.info        = info;
     this.entity      = entity;
     this.noiseGen    = noiseGen;
 }
    private void Awake()
    {
        ZoomScale = 0.01f;

        heightNoiseGen   = new SimplexNoiseGenerator(HeightSeed);
        moistureNoiseGen = new SimplexNoiseGenerator(MoistSeed);
        CreateTerrain();
    }
Ejemplo n.º 7
0
 public ComplexClimateMap(ComplexPlanet planet)
 {
     this.planet = planet;
     tempFluctuationGenerator = new SimplexNoiseGenerator(planet.Seed - 1, 1f / 64, 1f / 64)
     {
         Octaves = 3
     };
 }
Ejemplo n.º 8
0
 public HighMountainBiome(IPlanet planet, float minValue, float maxValue, float valueRangeOffset, float valueRange)
     : base(planet, minValue, maxValue, valueRangeOffset, valueRange)
 {
     BiomeNoiseGenerator = new SimplexNoiseGenerator(planet.Seed + 2)
     {
         FrequencyX = 1f / 256, FrequencyY = 1f / 256, FrequencyZ = 1f / 256, Persistance = 0.5f, Octaves = 6, Factor = 1f
     };
 }
Ejemplo n.º 9
0
        public void Init()
        {
            ridgedNoise  = new RidgidNoiseGenerator(ridgedSettings, seed);
            simplexNoise = new SimplexNoiseGenerator(simplexSettings, seed);

            GetComponent <MeshRenderer>().sharedMaterial = material;

            body.mass = radius * radius * density;
        }
Ejemplo n.º 10
0
    public bool Lookup(SimplexNoiseGenerator noiseGen, Vector3 pos)
    {
        pos.x += PosOffset;
        pos.y += PosOffset;
        pos.z += PosOffset;
        pos   *= PosScale;

        return(noiseGen.noise(pos.x, pos.y, pos.z) > NoiseThreshold);
    }
Ejemplo n.º 11
0
    void Start()
    {
        float t = Time.time;
        SimplexNoiseGenerator noiseGenerator = new SimplexNoiseGenerator();

        DestructibleSprite.seed = noiseGenerator.GetSeed();
        for (int x = 0; x < 15; x++)
        {
            Transform block = (Transform)Instantiate(terrainBlock, new Vector3(x, 0) * 2.62f, Quaternion.identity);
        }
    }
Ejemplo n.º 12
0
    public static void CreateNewSimplexNoiseGenerator(int seed)
    {
        int[]         seedArray = new int[8];
        System.Random rand      = new System.Random(seed);

        for (int i = 0; i < 8; i++)
        {
            seedArray[i] = rand.Next();
        }

        simplexNoiseGenerator = new SimplexNoiseGenerator(seedArray);
    }
Ejemplo n.º 13
0
        /// <summary>
        /// Run the generator against a world.
        /// </summary>
        /// <param name="world">The world to generate against.</param>
        public void RunGeneration(TWorld world)
        {
            var biasMap = (float[, ])null;

            switch (_biasType)
            {
            case HeightmapBias.CONTINENTS:
                biasMap = CreateRandomBias(world, CONTINENT_BIAS_SIZE);
                break;

            case HeightmapBias.AZEROTH:
                biasMap = CreateAzerothBias(world);
                break;

            case HeightmapBias.ISLANDS:
                biasMap = CreateRandomBias(world, ISLAND_BIAS_SIZE);
                break;

            case HeightmapBias.NONE:
                biasMap = CreateNoneBias(world);
                break;

            case HeightmapBias.LANDMASS:
                biasMap = CreateLandmassBias(world);
                break;

            default:
                throw new Exception("Unknown HeightmassBias: " + _biasType);
            }

            var noise = new SimplexNoiseGenerator(world.Seed + "height".GetHashCode());

            var noiseMap = new float[world.Width, world.Height];

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    noiseMap[x, y] = noise.CoherentNoise(x, y, 0, _octaves, _scale, 0.5f, _lacunarity, _persistence);
                }
            }

            noiseMap = MapUtil.Normalize(noiseMap);

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    world.GetCell(x, y).Height = world.MaxElevation * noiseMap[x, y] * biasMap[x, y];
                }
            }
        }
Ejemplo n.º 14
0
        public SurfaceBiomeGenerator(IPlanet planet, int seaLevel)
            : base(planet, 0f, 1f)
        {
            this.SeaLevel       = seaLevel;
            BiomeNoiseGenerator = new SimplexNoiseGenerator(planet.Seed)
            {
                FrequencyX = 1f / 10000, FrequencyY = 1f / 10000, Factor = 1f
            };

            float offset = (float)seaLevel / (Planet.Size.Z * Chunk.CHUNKSIZE_Z);

            SubBiomes.Add(new OceanBiomeGenerator(planet, 0f, 0.3f, 0f, offset));
            SubBiomes.Add(new LandBiomeGenerator(planet, 0.5f, 1f, offset, 1 - offset));

            SortSubBiomes();
        }
    public void OnValidate()
    {
        HeightSeed        = Math.Max(0, HeightSeed);
        MoistSeed         = Math.Max(0, MoistSeed);
        Octaves           = Mathf.Clamp(Octaves, 1, 16);
        OctavePersistence = Mathf.Clamp(OctavePersistence, 0.0f, 1.0f);
        MeshSideVertices  = Mathf.Max(2, MeshSideVertices);
        TextureResolution = MeshSideVertices * lod;
        ZoomScale         = Mathf.Max(0.01f, ZoomScale);
        Size = Mathf.Max(0.01f, Size);
        //transform.localScale = Vector3.one * Scale * 100;
        Biomes.Sort((b1, b2) => b1.StartHeight < b2.StartHeight ? -1 : 1);

        heightNoiseGen   = new SimplexNoiseGenerator(HeightSeed);
        moistureNoiseGen = new SimplexNoiseGenerator(MoistSeed);
    }
Ejemplo n.º 16
0
    /// <summary>
    /// ######################
    /// ######################
    /// BEGIN SECTION DEVOTED TO NOISE
    /// ######################
    /// ######################
    /// </summary>

    private void createSimplexMatrix()
    {
        for (int noiseNumber = 0; noiseNumber < matSizes.Length; noiseNumber++)
        {
            simplex = new SimplexNoiseGenerator((long)(UnityEngine.Random.Range(int.MinValue, int.MaxValue)));
            noiseMat.Add(new float[matSizes [noiseNumber], matSizes [noiseNumber]]);
            for (int y = 0; y < matSizes[noiseNumber]; y++)
            {
                for (int x = 0; x < matSizes[noiseNumber]; x++)
                {
                    //noiseMat [noiseNumber] [y, x] = (float)(simplex.Evaluate (x, y));
                    noiseMat [noiseNumber] [y, x] = (float)(UnityEngine.Random.Range(-1, 1));
                }
            }
        }
    }
Ejemplo n.º 17
0
        public LandBiomeGenerator(IPlanet planet, float minVal, float maxVal, float valueRangeOffset, float valueRange)
            : base(planet, valueRangeOffset, valueRange)
        {
            BiomeNoiseGenerator = new SimplexNoiseGenerator(planet.Seed + 1)
            {
                FrequencyX = 1f / 1000, FrequencyY = 1f / 1000, Persistance = 0.25f, Octaves = 5, Factor = 1f
            };

            MinValue = minVal;
            MaxValue = maxVal;

            SubBiomes.Add(new FlatlandBiome(planet, 0f, 0.2f, 0f, 0.1f));
            SubBiomes.Add(new HillsBiome(planet, 0.3f, 0.5f, 0.1f, 0.4f));
            SubBiomes.Add(new HighMountainBiome(planet, 0.8f, 1f, 0.2f, 0.8f));

            SortSubBiomes();
        }
Ejemplo n.º 18
0
    void Prepare()
    {
        var sn = new SimplexNoiseGenerator();

        for (int x = 0; x < lEdge; x++)
        {
            for (int y = 0; y < lEdge; y++)
            {
                for (int z = 0; z < lEdge; z++)
                {
                    var i   = x + lEdge * y + lEdge * lEdge * z;
                    var val = sn.noise(x, y, z);
                    data[i] = new Vector4(x, y, z, val);
                }
            }
        }
    }
Ejemplo n.º 19
0
    //##
    //END OF TEST METHODS
    //##


    /// <summary>
    /// ######################
    /// ######################
    /// BEGIN SECTION DEVOTED TO NOISE
    /// ######################
    /// ######################
    /// </summary>

    private void createSimplexMatrix()
    {
        noiseMat = new List <float[, ]>();

        for (int noiseNumber = 0; noiseNumber < 8; noiseNumber++)
        {
            simplex = new SimplexNoiseGenerator((long)(UnityEngine.Random.Range(int.MinValue, int.MaxValue)));
            noiseMat.Add(new float[matSizes[noiseNumber], matSizes[noiseNumber]]);
            for (int y = 0; y < matSizes[noiseNumber]; y++)
            {
                for (int x = 0; x < matSizes[noiseNumber]; x++)
                {
                    //finalHeightMap[y, x] = (float)((heightMap[y, x]+minValue)/(maxValue+Math.Abs(minValue)));
                    noiseMat[noiseNumber][y, x] = (float)(simplex.Evaluate(x, y));
                }
            }
        }
    }
Ejemplo n.º 20
0
        private float[,] CreateRandomBias(TWorld world, int biasGridSize)
        {
            var noise = new SimplexNoiseGenerator(world.Seed + "height_bias".GetHashCode());

            var biasGrid = new float[biasGridSize, biasGridSize];

            for (int x = 0; x < biasGridSize; x++)
            {
                for (int y = 0; y < biasGridSize; y++)
                {
                    biasGrid[x, y] = noise.CoherentNoise(x, y, 0, 1, 3, 0.5f, 2, 0.9f);
                }
            }

            biasGrid = MapUtil.Normalize(biasGrid);

            for (int x = 0; x < biasGridSize; x++)
            {
                for (int y = 0; y < biasGridSize; y++)
                {
                    if (x <= 0 || x >= biasGridSize - 1 || y <= 0 || y >= biasGridSize - 1)
                    {
                        //Force a bias of zero at the edges.
                        biasGrid[x, y] = 0;
                    }
                    else
                    {
                        //select high points

                        if (biasGrid[x, y] > 0.6)
                        {
                            biasGrid[x, y] = 1;
                        }
                        else
                        {
                            biasGrid[x, y] = 0;
                        }
                    }
                }
            }

            return(ExpandBiasGridToMap(world, biasGrid, biasGridSize));
        }
Ejemplo n.º 21
0
    //##
    //END OF TEST METHODS
    //##


    /// <summary>
    /// ######################
    /// ######################
    /// BEGIN SECTION DEVOTED TO NOISE
    /// ######################
    /// ######################
    /// </summary>

    private void createSimplexMatrix()
    {
        noiseMat = new List <float[, ]>();

        for (int noiseNumber = 1; noiseNumber < 2; noiseNumber++)
        {
            simplex = new SimplexNoiseGenerator((long)(UnityEngine.Random.Range(int.MinValue, int.MaxValue)));
            noiseMat.Add(new float[noiseNumber * 128, noiseNumber * 128]);
            print(noiseMat[noiseNumber - 1].Length);
            for (int y = 0; y < noiseNumber * 128; y++)
            {
                for (int x = 0; x < (noiseNumber * 128); x++)
                {
                    //finalHeightMap[y, x] = (float)((heightMap[y, x]+minValue)/(maxValue+Math.Abs(minValue)));
                    noiseMat[noiseNumber - 1][y, x] = (float)(simplex.Evaluate(x, y));
                }
            }
        }
    }
Ejemplo n.º 22
0
    void timerTest()
    {
        print("starting Timer");
        timer.Start();
        //time assigning single float random number
        simplex = new SimplexNoiseGenerator((long)(UnityEngine.Random.Range(int.MinValue, int.MaxValue)));
        float simplexNumber = 0;

        for (long x = 0; x < 22400000; x++)
        {
            simplexNumber = (float)(simplex.Evaluate(x, 0));
        }
        //print times
        print("Time: " + timer.ElapsedMilliseconds);
        print("final Number:" + simplexNumber);
        timer.Reset();
        //timer for
        timer.Start();
        createSimplexMatrix();
        print("Time for full simplex: " + timer.ElapsedMilliseconds);
    }
        /// <summary>
        /// Run the generator against a world.
        /// </summary>
        /// <param name="world">The world to generate against.</param>
        public void RunGeneration(TWorld world)
        {
            var noiseMap = new float[world.Width, world.Height];

            var mountainNoise = new SimplexNoiseGenerator(world.Seed + "mountain_ridge".GetHashCode());

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    noiseMap[x, y] = Math.Abs(mountainNoise.CoherentNoise(x, y, 0, 1, 250, 0.5f, 2, 0.4f));
                }
            }

            noiseMap = MapUtil.Normalize(noiseMap);

            var newHeightMap = new float[world.Width, world.Height];

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    var noiseValue = 1 - (noiseMap[x, y] - 0.2f) * 1.25f;

                    var percHeight = world.GetCell(x, y).Height / world.MaxElevation;

                    newHeightMap[x, y] = 0.7f * percHeight + 0.3f * noiseValue * (0.5f + percHeight / 2);
                }
            }

            newHeightMap = MapUtil.Normalize(newHeightMap);

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    world.GetCell(x, y).Height = world.MaxElevation * newHeightMap[x, y];
                }
            }
        }
Ejemplo n.º 24
0
        public static Planet Generate(int radius, int terrainHeight, int?heightLimit0 = null)
        {
            int numDivisions = (int)Mathf.Sqrt((Mathf.PI * Mathf.Pow(radius, 2)) / 5);

            int heightLimit = (heightLimit0 == null) ? terrainHeight + 20 : (int)heightLimit0;

            Hexasphere hexasphere = new Hexasphere(radius, numDivisions);

            Region[] regions = hexasphere.Regions;

            var noiseGenerator = new SimplexNoiseGenerator();

            foreach (var region in regions)
            {
                region.GenerateTerrain(noiseGenerator, terrainHeight, heightLimit, radius);
            }

            var planet = new Planet(radius, terrainHeight);

            planet.Regions = regions;

            return(planet);
        }
Ejemplo n.º 25
0
        static void TestSimplexNoise()
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            SimplexNoiseGenerator sng = new SimplexNoiseGenerator(Environment.TickCount);

            sw.Start();
            for (int x = 0; x < 16; x++)
            {
                for (int y = 0; y < 128; y++)
                {
                    for (int z = 0; z < 16; z++)
                    {
                        sng.noise3d(x, y, z);
                    }
                }
            }
            sw.Stop();

            Console.WriteLine("Done in {0}ms.", sw.ElapsedMilliseconds);

            Console.ReadKey();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Run the generator against a world.
        /// </summary>
        /// <param name="world">The world to generate against.</param>
        public void RunGeneration(TWorld world)
        {
            var oceanBiaser = new OceanBiaser <TWorld, TCell>();

            oceanBiaser.CreateBiasPoints(world, 25);

            var noise = new SimplexNoiseGenerator(world.Seed + "temperature".GetHashCode());

            var noiseMap = new float[world.Width, world.Height];

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    noiseMap[x, y] = noise.CoherentNoise(x, y, 0, 3, 100, 0.5f, 2, 0.4f);
                }
            }

            noiseMap = MapUtil.Normalize(noiseMap);

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    var baseT = y / (float)world.Height * 2;

                    if (y > world.Height / 2)
                    {
                        baseT = (world.Height - y) / (float)world.Height * 2;
                    }

                    var oceanBias = 1f - 0.3f * oceanBiaser.OceanBiasAt(new CellAddress(x, y));

                    world.GetCell(x, y).Temperature = (0.8f * baseT + 0.2f * noiseMap[x, y]) * oceanBias;
                }
            }
        }
        /// <summary>
        /// Run the generator against a world.
        /// </summary>
        /// <param name="world">The world to generate against.</param>
        public void RunGeneration(TWorld world)
        {
            var oceanBiaser = new OceanBiaser <TWorld, TCell>();

            oceanBiaser.CreateBiasPoints(world, 25);

            var noise = new SimplexNoiseGenerator(world.Seed + "rain".GetHashCode());

            var rainfallMap = new float[world.Width, world.Height];

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    var bias = (float)(-1 * Math.Cos(y / Math.PI / (world.Height / 6f)) / 2 + 0.5f);
                    bias = 0.75f * bias + 0.25f;

                    rainfallMap[x, y] = noise.CoherentNoise(x, y, 0, 3, 75, 0.5f, 2, 0.4f) * bias;
                }
            }

            rainfallMap = MapUtil.Normalize(rainfallMap);

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    if (!IsOcean(x, y, world))
                    {
                        var oceanBias = oceanBiaser.OceanBiasAt(new CellAddress(x, y));

                        world.GetCell(x, y).Rainfall = 0.8f * rainfallMap[x, y] + 0.2f * oceanBias;
                    }
                }
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Run the generator against a world.
        /// </summary>
        /// <param name="world">The world to generate against.</param>
        public void RunGeneration(TWorld world)
        {
            var noise = new SimplexNoiseGenerator(world.Seed + "rain".GetHashCode());

            var noiseMap = new float[world.Width, world.Height];

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    noiseMap[x, y] = noise.CoherentNoise(x, y, 0, _octaves, _scale, 0.5f, _lacunarity, _persistence);
                }
            }

            noiseMap = MapUtil.Normalize(noiseMap);

            for (int x = 0; x < world.Width; x++)
            {
                for (int y = 0; y < world.Height; y++)
                {
                    world.GetCell(x, y).Rainfall = noiseMap[x, y];
                }
            }
        }
Ejemplo n.º 29
0
        public void GenerateTerrain(SimplexNoiseGenerator noiseGenerator, int terrainHeight, int heightLimit, int planetRadius)
        {
            var chunkHeight = Mathf.CeilToInt(heightLimit / Chunk.CHUNK_HEIGHT);

            Chunks = new Chunk[chunkHeight];
            for (var i = 0; i < chunkHeight; i++)
            {
                Chunks[i] = new Chunk(Center + Center.normalized * Chunk.CHUNK_HEIGHT * i, Tiles.Count, i, this);
            }

            for (var i = 0; i < Tiles.Count; i++)
            {
                var tile   = Tiles[i];
                var height = Mathf.Max(terrainHeight - noiseGenerator.getDensity(tile.Center.AsVector(), 0, terrainHeight, octaves: 3, persistence: 0.60f, multiplier: planetRadius / 2), 0);

                for (var j = 0; j < Chunks.Length; j++)
                {
                    for (var h = 0; h < Chunk.CHUNK_HEIGHT; h++)
                    {
                        if (j == 0 && h == 0)
                        {
                            Chunks[j].SetBlock(i, h, 1, false);
                        }
                        else if (j * Chunk.CHUNK_HEIGHT + h < height)
                        {
                            Chunks[j].SetBlock(i, h, 2, false);
                        }
                        else
                        {
                            Chunks[j].SetBlock(i, h, 0, false);
                        }
                    }
                    Chunks[j].CheckForEmptiness();
                }
            }
        }
Ejemplo n.º 30
0
    public Texture3D GenerateNoise()
    {
        SimplexNoiseGenerator noise = new SimplexNoiseGenerator();

        Color[]   colorArray = new Color[_textureSize * _textureSize * _textureSize];
        Texture3D texture    = new Texture3D(_textureSize, _textureSize, _textureSize, _format, false);

        for (int x = 0; x < _textureSize; x++)
        {
            for (int y = 0; y < _textureSize; y++)
            {
                for (int z = 0; z < _textureSize; z++)
                {
                    float value = noise.coherentNoise(x, y, z, _octaves, _multiplier, _amplitude, _lacunarity, _persistence);
                    Color c     = new Color(value, 0.0f, 0.0f, 1.0f);
                    colorArray[x + (y * _textureSize) + (z * _textureSize * _textureSize)] = c;
                }
            }
        }

        texture.SetPixels(colorArray);
        texture.Apply();
        return(texture);
    }
Ejemplo n.º 31
0
    void generateTerrainSimplex()
    {
        simplexNoise = new SimplexNoiseGenerator (Random.Range (0, 10000).ToString ());
        float[] heightMap;

        heightMap = new float[loadDistance * loadDistance];

        diamondSquare.GRAIN = GRAIN;
        diamondSquare.mountainHeight = mountainHeight;

        diamondSquare.generateHeightMap (loadDistance, loadDistance, heightMap);

        float seedX = Random.Range (5f, 10f);
        float seedY = Random.Range (1f, 10f);

        float seed = 1f;

        /*
        for (int i = 0; i < loadDistance; i+= iteratorCount) {
            for (int j = 0; j< loadDistance; j+= iteratorCount) {

                //int density = (int)(Mathf.PerlinNoise (((float)i / (float)loadDistance) * (loadDistance / 75.0f) * frequency*((i/(float)loadDistance)% (loadDistance/5.0f)), ((j / (float)loadDistance)) * (loadDistance / 75.0f)* frequency*((j/(float)loadDistance)% (loadDistance/5.0f))) * mountainHeight);
            //	int density =  (int)(heightMap[j + i*loadDistance]*mountainHeight);
                //int density = mountainHeight;
                //int density = (int)(perlin.perlin((i/(float)loadDistance), 0, (j/(float)loadDistance))*mountainHeight);
                //int density = (int)(Mathf.PerlinNoise((i/(float)loadDistance)* (loadDistance / 75.0f)*frequency, (j/(float)loadDistance)* (loadDistance / 75.0f)*frequency)*mountainHeight);
                int density = (int)(perlin.OctavePerlin((i/(float)loadDistance)*frequency, 0, (j/(float)loadDistance)*frequency, 4, 0.5f)*mountainHeight);
                for (int k = 1; k < density; k++) {
                    //worldScript.set_voxel (i, loadDistance + k, j, 1);
                    if(perlin.OctavePerlin((i/(float)loadDistance)*4, k/(float)density, j/(float)loadDistance*4, 8, 0.3f) > 0.5f){
                    //if (simplexNoise.noise ((i / (float)loadDistance)  , (k / (float)density)*5, (j / (float)loadDistance))  > 0.0f) {
                        worldScript.set_voxel (i, loadDistance + k, j, 1);

                    }

                }
                worldScript.set_voxel (i, loadDistance, j, 5);
            }
        }
        */
    }