GenerateSpherical() private method

Generates a spherical projection of a point in the noise map.
private GenerateSpherical ( float lat, float lon ) : float
lat float The latitude of the point.
lon float The longitude of the point.
return float
    private Texture2D texture; // texture created for testing

    #endregion Fields

    #region Methods

    //  Other Functions
    //    ----------------------------------------------------------------------------
    void Generate(bool addToSeed)
    {
        Perlin mySphere = new Perlin();
        mySphere.Seed = seedToModify;
        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.GenerateSpherical( south, north, west, east );
        texture = heightMap.GetTexture(GradientPresets.Grayscale);
        sphereRenderer.material.mainTexture = texture;
        //Debug.LogWarning("Removed Generate Planet Clouds to save on load times for now till I optimize it and make it run better.");
    }
Example #2
0
    private Texture2D texture; // texture created for testing

    #endregion Fields

    #region Methods

    void Generate(bool addToSeed)
    {
        Perlin mySphere = new Perlin();
        mySphere.Seed = seedToModify;
        mySphere.OctaveCount = octaves;
        // modify the frequency
        mySphere.Frequency = frequency;
        // modify the persistence
        mySphere.Persistence = persistence;

        ModuleBase myModule;

        myModule = mySphere;
        mySphere.Lacunarity = 2.5;

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

        // - 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.GenerateSpherical( south, north, west, east );
        texture = heightMap.GetTexture(GradientPresets.Grayscale);
        sphereRenderer.material.mainTexture = texture;

        texture = heightMap.GetTexture(GradientPresets.planetColors);

        sphereRenderer.material.SetTexture("_Normals",heightMap.GetNormalMap(3));
        texture = heightMap.GetTexture(GradientPresets.planetLightColors);
        sphereRenderer.material.SetTexture("_Lights",texture);
    }
    private Texture2D texture; // texture created for testing

    #endregion Fields

    #region Methods

    void Generate(bool addToSeed)
    {
        Voronoi mySphere = new Voronoi();
        mySphere.Seed = seedToModify;

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

        // - 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.GenerateSpherical( south, north, west, east );
        texture = heightMap.GetTexture(GradientPresets.RGBA);
        sphereRenderer.material.mainTexture = texture;

        sphereRenderer.material.SetTexture("_Normals",texture);
    }
    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;
    }
	void Start() 
	{
		var perlin = new Perlin();

		var heightMapBuilder = new Noise2D(512, 256, perlin);
		heightMapBuilder.GenerateSpherical(_north, _south, _west, _east);

		var image = heightMapBuilder.GetTexture(_gradient);
		renderer.material.mainTexture = image;



	}
Example #6
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;
    }
    //  Other Functions
    //    ----------------------------------------------------------------------------
    void Generate()
    {
        //Perlin mySphere = new Perlin();

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

        // - Compiled Terrain -

        ModuleBase myModule;

        myModule = Generator.LibnoiseModualGen.GetRTSGenerator(1);

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

        // - 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.GenerateSpherical( south, north, west, east );

        texture = heightMap.GetTexture(GradientPresets.Grayscale);

        ///

        #if !UNITY_WEBPLAYER
        byte[] bytes = texture.EncodeToPNG();
        File.WriteAllBytes(Application.dataPath + "/Terain/TextureGenOutput/sphere/"+TextureName+".png", bytes);
        #endif
        ///

        sphereRenderer.material.mainTexture = texture;
    }