0

I just started on my first perlin noise project, but when I test it out it gives back insanely high numbers.
To my understanding they are supposed to stay between 1 and -1.

Also when I change the lacunarity to an even value, it only returns zero's.

It should be noted that I use the c# port of the Libnoise library.

Screenshots

Here's the code that I wrote:

namespace Perlin
{
    public partial class Form1 : Form
    {
        double frequency, lacunarity, persistence;
        int octaveCount, resolutie;

        public Form1()
        {
            InitializeComponent();
            LibNoise.Perlin perlinMap = new LibNoise.Perlin();
            // perlinMap.Frequency =
        }



        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            octaveCount = trackBar1.Value;
            textBox1.Text = octaveCount.ToString();
            //  textBox5.Text = LibNoise.GradientNoiseBasis((double)trackBar1.Value,   (double)trackBar1.Value, (double)trackBar1.Value, 1024,     LibNoise.NoiseQuality.Standard).ToString;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void trackBar2_Scroll(object sender, EventArgs e)
        {
            persistence = (trackBar2.Value * 5);
            textBox3.Text = persistence.ToString() + "%";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            LibNoise.Perlin perlinMap = new LibNoise.Perlin();
            perlinMap.Lacunarity = lacunarity;
            perlinMap.NoiseQuality = LibNoise.NoiseQuality.Standard;
            perlinMap.OctaveCount = octaveCount;
            perlinMap.Persistence = persistence;
            perlinMap.Seed = 1024;

            textBox12.Text = perlinMap.GetValue(0.23, 0, 1).ToString();
            textBox13.Text = perlinMap.GetValue(1, 1.25, 1).ToString();
            textBox14.Text = perlinMap.GetValue(2, 0, 1.75).ToString();

            textBox15.Text = perlinMap.GetValue(0, 1, 1).ToString();
            textBox16.Text = perlinMap.GetValue(1, 1, 1).ToString();
            textBox17.Text = perlinMap.GetValue(2, 1, 1).ToString();

            textBox18.Text = perlinMap.GetValue(0, 2, 1).ToString();
            textBox19.Text = perlinMap.GetValue(1, 2, 1).ToString();
            textBox20.Text = perlinMap.GetValue(2, 2, 1).ToString();



        }

        private void trackBar3_Scroll(object sender, EventArgs e)
        {
            lacunarity = (trackBar3.Value / 2d + 0.5d);
            textBox7.Text = lacunarity.ToString();
        }

        private void trackBar4_Scroll(object sender, EventArgs e)
        {
            frequency = Math.Pow(2, trackBar4.Value + 1);
            textBox8.Text = frequency.ToString();
        }

        private void trackBar5_Scroll(object sender, EventArgs e)
        {
            frequency = Math.Pow(2, trackBar5.Value + 4);
            textBox10.Text = frequency.ToString();
        }
    }
}

Any help is greatly appreciated!

user3376217
  • 35
  • 3
  • 9
  • edit your post to include a tag indicating what language preference you are using (looks like C variant ?) You will get more people looking at it that way. – ryyker Jun 05 '14 at 20:18
  • You did it exactly right, but you need to do it again since another edit stomped on it. – Ben Voigt Jun 05 '14 at 20:23
  • ***[HERE](http://docs.unity3d.com/ScriptReference/Mathf.PerlinNoise.html)*** is another example that Creates a texture and fills it with Perlin noise, also using c#. But from what Ben says, you already have it right? – ryyker Jun 05 '14 at 20:30

1 Answers1

0

I've found the anwere guys, persistence should be a value between 0 and 1, instead I used values between 5 and 50.

user3376217
  • 35
  • 3
  • 9