I have been experimenting with a variety of noise over the last few days, from perlin, simplex, value, etc…
The problem I have come, is not in the base noise, but how to output it.
Whenever I generate anything, it always appear pure static, and for the longest time, I thought I was doing something wrong. Until I realized its not supposed to be anything but static. Its the manipulation of that noise that produces what I want.
That’s when I learned more properly about octaves, persistence, frequency, periods. Also about fractal(fractional?) brownian motion.
I have looked at a whole lot libs/examples, (unfortunately, most of them are in other languages) and tried my best to convert them to Java.
Unfortunately, All I can ever get is the just plain static.(pure noise)
I just want smooth(cloudy/terrain) looking output.
For the sake of argument, I am going to be using Improved noise from perlins website and/or simplex noise(2D) from
http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf (bottom of page/source) (removed the 3D and 4D components)
http://mrl.nyu.edu/~perlin/noise/ (improved noise from perlin)
Although I have tried several variations/functions of SmoothNoise, I am going to pick one to show
double corners = ( Noise.noise(i-1, j-1)+Noise.noise(i+1, j-1)+Noise.noise(i-1, j+1)+Noise.noise(i+1, j+1) ) / 16;
double sides = ( Noise.noise(i-1, j) +Noise.noise(i+1, j) +Noise.noise(i, j-1) +Noise.noise(i, j+1) ) / 8;
double center = Noise.noise(i, j) / 4;
map[i][j] = corners+sides+center;
Once again, I am aware of several interpolation methods, either a basic one or cosine, etc…
http://paulbourke.net/miscellaneous/interpolation/
I am just going to pick a basic one for now.
public float interpolate(float d, float e, float alpha){
return (float) ((1-alpha)*d+alpha*e);
}
I also tried using
public float Cosine_Interpolate(float a, float b, float x){
float ft = (x * 3.1415927f);
float f = (float) ((1 - Math.cos(ft)) * .5);
return a*(1-f) + b*f;
}
Frequency is 2^octave
amplitude is persistence^octave
http://freespace.virgin.net/hugo.elias/models/m_perlin.htm (scroll down to the [2-dimensional Perlin Noise Pseudocode] section) as my main reference.
The problem now comes in actually producing the data. I am filling everything into a 512x512 array.
I am producing an output using LWJGL and GL_Points, 1 colored point for each point in the array. Also tried both with grayscale, color gradients, manual scaling(i.e. anything in ranges produce 1 color, (so it only outputs 3-4 total colors, and not gradients)
I just am starting to get extremely frustrated. Does anyone have any “non easily found website references”
or some extremely simple to the point functioning equation that takes input noise and does the smooth,interpolate, octaves, etc… properly?
I know its not the easiest topic to be jumping at.
I am probably overlooking something really stupid, but I am just a little lost.