示例#1
0
    // Use this for initialization
    void Start()
    {
        IModule mountainTerrain = new RidgedMulti();
        IModule baseFlatTerrain = new Billow();
        ((Billow)baseFlatTerrain).Frequency = 2.0;
        IModule flatTerrain = new ScaleBias(baseFlatTerrain, 0.125, -0.75);
        IModule terrainType = new Perlin();
        ((Perlin)terrainType).Frequency = 0.5;
        ((Perlin)terrainType).Persistence = 0.25;
        IModule terrainSelector = new Select(flatTerrain, mountainTerrain, terrainType);
        ((Select)terrainSelector).SetBounds(0.0, 1000.0);
        ((Select)terrainSelector).SetEdgeFallOff(0.125);
        IModule finalTerrain = new Turbulence(terrainSelector);
        ((Turbulence)finalTerrain).Frequency = 4.0;
        ((Turbulence)finalTerrain).Power = 0.125;

        NoiseMapBuilderPlane heightMapBuilder = new NoiseMapBuilderPlane(256, 256);
        heightMapBuilder.SetBounds(6.0, 10.0, 1.0, 5.0);
        heightMapBuilder.Build(finalTerrain);
        RendererImage render = new RendererImage();
        render.SourceNoiseMap = heightMapBuilder.Map;
        render.ClearGradient ();
        render.AddGradientPoint(-1.0000, new Color32(32, 160, 0, 255));
        render.AddGradientPoint(-0.2500, new Color32(224, 224, 0, 255));
        render.AddGradientPoint(0.2500, new Color32(128, 128, 128, 255));
        render.AddGradientPoint(1.0000, new Color32(255, 255, 255, 255));
        render.IsLightEnabled = true;
        render.LightContrast = 3.0;
        render.LightBrightness = 2.0;
        render.Render();

        tex = render.GetTexture();
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        IModule primaryGranite = new Billow();
        ((Billow)primaryGranite).Seed = 0;
        ((Billow)primaryGranite).Frequency = 8.0;
        ((Billow)primaryGranite).Persistence = 0.625;
        ((Billow)primaryGranite).Lacunarity = 2.18359375;
        ((Billow)primaryGranite).OctaveCount = 6;
        ((Billow)primaryGranite).NoiseQuality = NoiseQuality.Standard;

        IModule baseGrains = new Voronoi();
        ((Voronoi)baseGrains).Seed = 1;
        ((Voronoi)baseGrains).Frequency = 16.0;
        ((Voronoi)baseGrains).EnableDistance = true;

        IModule scaledGrains = new ScaleBias(baseGrains);
        ((ScaleBias)scaledGrains).Scale = -0.5;
        ((ScaleBias)scaledGrains).Bias = 0.0;

        IModule combinedGranite = new Add(primaryGranite, scaledGrains);

        IModule finalGranite = new Turbulence(combinedGranite);
        ((Turbulence)finalGranite).Seed = 2;
        ((Turbulence)finalGranite).Frequency = 4.0;
        ((Turbulence)finalGranite).Power = 1.0 / 8.0;
        ((Turbulence)finalGranite).Roughness = 6;

        NoiseMapBuilderPlane plane = new NoiseMapBuilderPlane(256, 256);
        plane.SetBounds(-1.0, 1.0, -1.0, 1.0);
        plane.Build(finalGranite);
        RendererImage render = new RendererImage();
        render.SourceNoiseMap = plane.Map;
        render.ClearGradient ();
        render.AddGradientPoint (-1.0000, new Color32(  0,   0,   0, 255));
        render.AddGradientPoint (-0.9375, new Color32(  0,   0,   0, 255));
        render.AddGradientPoint (-0.8750, new Color32(216, 216, 242, 255));
        render.AddGradientPoint ( 0.0000, new Color32(191, 191, 191, 255));
        render.AddGradientPoint ( 0.5000, new Color32(210, 116, 125, 255));
        render.AddGradientPoint ( 0.7500, new Color32(210, 113,  98, 255));
        render.AddGradientPoint ( 1.0000, new Color32(255, 176, 192, 255));
        render.IsLightEnabled = true;
        render.LightAzimuth = 135.0;
        render.LightElev = 60.0;
        render.LightContrast = 2.0;
        render.LightColor = new Color32(255, 255, 255, 0);
        render.Render();

        tex = render.GetTexture();
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        IModule module = new Perlin();
        NoiseMapBuilderSphere heightMap = new NoiseMapBuilderSphere(512, 256);
        heightMap.SetBounds(-90.0, 90.0, -180.0, 180.0);
        heightMap.Build(module);
        RendererImage render = new RendererImage();
        render.SourceNoiseMap = heightMap.Map;
        render.ClearGradient ();
        render.AddGradientPoint (-1.0000, new Color32(  0,   0, 128, 255)); // deeps
        render.AddGradientPoint (-0.2500, new Color32(  0,   0, 255, 255)); // shallow
        render.AddGradientPoint ( 0.0000, new Color32(  0, 128, 255, 255)); // shore
        render.AddGradientPoint ( 0.0625, new Color32(240, 240,  64, 255)); // sand
        render.AddGradientPoint ( 0.1250, new Color32( 32, 160,   0, 255)); // grass
        render.AddGradientPoint ( 0.3750, new Color32(224, 224,   0, 255)); // dirt
        render.AddGradientPoint ( 0.7500, new Color32(128, 128, 128, 255)); // rock
        render.AddGradientPoint ( 1.0000, new Color32(255, 255, 255, 255)); // snow
        render.IsLightEnabled = true;
        render.LightContrast = 3.0;
        render.LightBrightness = 2.0;
        render.Render();

        tex = render.GetTexture();
    }