Ejemplo n.º 1
0
        public float GetPointSample(UV uv)
        {
            var v = (float)_Perlin
                    .OctavePerlin(uv.X, uv.Y, _Depth, _Octaves, _Persistence)
                    .Clamp(0, 1);

            return(v);
        }
Ejemplo n.º 2
0
        private static void _FillPerlinNoise(this Image <HalfSingle> image, float scale = 16, int repeat = 0, int octaves = 8, double persistence = 0.1f, int randomSeed = 177)
        {
            var generator = new Perlin_Tileable(randomSeed, repeat);

            for (int y = 0; y < image.Height; ++y)
            {
                for (int x = 0; x < image.Width; ++x)
                {
                    var xx = (float)x / scale;
                    var yy = (float)y / scale;

                    var p = (float)generator.OctavePerlin(xx, yy, 0, octaves, persistence);

                    var pp = new HalfSingle(p);

                    image[x, y] = pp;
                }
            }

            image._MutateAutoLevels();
        }