I am making a heightmap using simplex noise. I am running into problems adjusting it to give a slight tendency to form an island. I am just working on getting the values to be correct before actually rendering the biomes and other features. I have run into the problem that my code, which should work to create this tendency to make an island in the middle only seems to work in one direction.
If there a particular reason for this? My class that deals with the smoothing out of the terrain does the same thing in the x and y directions, but only one works.
public class MapGenerator{
public double[][] toRender;
int maxHeight = 300;
public MapGenerator() {
int xResolution = 200;
int yResolution = 200;
double[][] result = new double[xResolution][yResolution];
for (int x = 0; x < xResolution; x++){
for (int y = 0; y < yResolution; y++){
result[x][y] = transformPoint(x, y, xResolution, yResolution, SimplexNoise.noise(x, y));
}
}
toRender = result;
}
private double transformPoint(int x, int y, int xSize, int ySize, double point){
System.out.println();
System.out.println(point);
point += 20 * Math.sin(x * Math.PI / xSize);
point += 20 * Math.sin(y * Math.PI / ySize);
System.out.println(point);
return point;
}
}
Images of the white noise:
With only X (Y commented out):
[With only Y (X commented out):](Similar to X and Y, can't post link because of reputation.)
[Without X and Y:](Similar to only X, can't post link because of reputation.)
I'm not 100% where your error is. It could be in your noise routine. To debug this, I removed the call to
noise
and substituted a constant value of 0.5. Then I got the rest of it working so I saw a white halo in the center of the image. Then I added thenoise
call back. (Note I'm using my ownSimplexNoise
here.)So the problem is either in your bounds (
Math.min( 1.0, point ))
or in your graphics display (which you don't show) or in yourSimplexNoise
(which you also don't show).