2
\$\begingroup\$

Okay so I have been trying to make perlin noise, fractal noise to be specific, with mixed success. What I do is I fill 5 arrays with white noise, basically just floating point values. Each array is four times as big as the last array. Then what I do is add each of these arrays together. What I have gathered from my extensive research is that putting this into a picture with a gray-scale should produce something like Pic One, but what i'm getting out is Pic Two. I really have no understanding of what i'm doing wrong, and I would appreciate some clarity and explanation on the subject.

Pic One

Pic Two

Some sites I'v read through.

Libnoise

Perlin Noise Demo

Edit:

I know for sure it has nothing to do with the how i'm rendering the noise. I'm also fairly sure that how I add the noise is not an issue.

Edit 2:

I have one more question. In some implementations I see that they interpolate between 4 gradients, and I understand how to get the value using dot product and whatnot. (Talking about 2 dimensional noise). My question is what would the difference be between using gradient vectors at each point or using a value representing height? Is there one that is better than the other? Thanks.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

Extensive? Extensive.

imagine totally white noise (audio). Then add 4 more times of white noise to it. Would you get any sort of pattern emerging? Statistics say white noise + white noise=more white noise.

Perlin noise isn't truly random. It's pseudorandom. What it is is pseudorandom values spaced out on a grid, then the values in between the grid points are interpolated so the noise appears smooth.

*----*
|n3  |n4
|    |
*----*
n1   n2

So here, n1, n2, n3 and n4 would have actual noise values defined for them. but all the -- points between n1..n2 etc would be interpolated.

Don't implement Perlin noise yourself.. it's really just reinventing the wheel.

The best implementation I've found so far is Stefan Gustafson's DSONoises.zip. Download it and check out the functions.

\$\endgroup\$
0
3
\$\begingroup\$

Fractal noise is usually produced by summing up Perlin noise taken at varying frequencies. You can't really generate it by adding up arrays of white noise... Classic Perlin noise can be found here: http://mrl.nyu.edu/~perlin/noise/ you can then produce "fractal noise" through simple fractional Brownian motion:

float fbm(in vec3 v, in int octaves){

      float frequency = 0.6;
      float persistence = 0.6;
      float lacunarity = 2.0;
      float sum = 0.0;
      float noise = 0.0;
      float pers = 1.0;
      v *= frequency;

      for (int i = 0; i<octaves; i++)
      {
         noise = noise(v);
         sum += noise * pers;
         v *= lacunarity;
         pers *= persistence;
    }
    return  sum;
}

If you want to keep your one array of white noise you can use it to create "smooth noise" as one of those websites describe. This means that you simply interpolate across the random values in the array and then take the values in the array and sum them up at different frequencies (see above algorithm). I don't believe that method is actually Perlin noise but a variant known as "value noise".

Edit: I forgot to include this: http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf It's the best summary of Perlin noise I've seen.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Yes, what he said! First, Perlin is not white noise. Perlin is a gradient noise and returns a very smooth data field, it's actually very boring. What the above pseudocode does is take that boring base noise at one sampling point and then offset that value for a number of octaves as a count and each time reduce the offset so each new sample modifies but does not overpower the base sample. Your first picture shows a very smooth field that's been perturbed. You cannot get this effect by simply adding piles of white noises on top of each other. \$\endgroup\$ Jan 2, 2014 at 5:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .