Question

i've seen so many examples for perlin noise out there, but they all where slightly diferent.

i'm wondering how i can use perlin noise algorythm to create an image in c#.

i would like to have a function that every time i call it, generates a new image and places it in a picturebox.

i've looked the perlin noise pseudo code, but i got confused. i want to be able to manipulate some attributes with user input.

but now my question:

how can i integrate perlin noise into c# function that returns bitmap data ( 2d ) ?

Était-ce utile?

La solution

        Bitmap bmp = new Bitmap(200, 200);

        for (int x = 0; x < 200; x++)
        {
            for (int y = 0; y < 200; y++)
            {
                int calc = (int)(((SimplexNoise.Noise.Generate(x, y)+1)/2)*255);
                bmp.SetPixel(x, y, Color.FromArgb(calc, calc, calc));
            }
        }

I was using https://code.google.com/p/simplexnoise/ but you can use any noise generator.

I hope this helps

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top