Smoothing simplex noise

So I plugged in some code and made a color coded simplex noise generator as the first step towards generating terrain. I have these values:

Reds are higher values while yellows are lower values. As you can see, the values are kind of choppy and I want to smooth out these values.

Any ideas?

CopyableCougar4

Lower the frequency (divide the input values by a larger number)

Is this a good approach? I take the average of the four surrounding points and “soften” the inputted value by a given factor. Here is my “softening” method called [icode]normalize()[/icode].

private double normalize(double value, int x, int y) {
		double leftRightAvg = (heightMap[x - 1][y] + heightMap[x + 1][y]) / 2;
		double bottomTopAvg = (heightMap[x][y - 1] + heightMap[x][y - 1]) / 2;
		double avg = (leftRightAvg + bottomTopAvg) / 2;
		double delta = value - avg;
		delta *= NORMALIZER;
		return avg + delta;
	}
	
	private double NORMALIZER = 0.85;

Is this a good idea? Any other ways to smooth out the values?

CopyableCougar4

Do what HeroesGraveDev says. If you smooth those speckles, your terrain won’t look very interesting.

This is my current code:

private double dampen(double value) {
		return value * DAMPENING + OFFSET;
	}
	
	private double normalize(double value, int x, int y) {
		double leftRightAvg = (heightMap[x - 1][y] + heightMap[x + 1][y]) / 2;
		double bottomTopAvg = (heightMap[x][y - 1] + heightMap[x][y - 1]) / 2;
		double avg = (leftRightAvg + bottomTopAvg) / 2;
		double delta = value - avg;
		delta *= NORMALIZER;
		return avg + delta;
	}
	
	private double NORMALIZER = 0.75, DAMPENING = 0.55, OFFSET = 0.15;
	
	public void generate() {
		SimplexNoiseGenerator.genGrad(new FastRand(seed));
		for (int pointer1 = 0; pointer1 < heightMap.length; pointer1++) {
			for (int pointer2 = 0; pointer2 < heightMap[0].length; pointer2++) {
				heightMap[pointer1][pointer2] = dampen(SimplexNoiseGenerator.noise(pointer1, pointer2));
			}
		}
		for (int pointer1 = 1; pointer1 < heightMap.length - 1; pointer1++) {
			for (int pointer2 = 1; pointer2 < heightMap[0].length - 1; pointer2++) {
				heightMap[pointer1][pointer2] = normalize(heightMap[pointer1][pointer2], pointer1, pointer2);
			}
		}
	}

I guess I invisioned (because this is my first dive into simplex noise) that there would be smooth drops around a few peaks. Where should I search for achieving something like this?

CopyableCougar4

try

SimplexNoiseGenerator.noise(pointer1*0.001f, pointer2*0.001f)

if noise() takes float arguments.

Thanks, but it takes doubles.

[icode] public static double noise(double xin, double yin)[/icode]

CopyableCougar4

thats same good :slight_smile:

SimplexNoiseGenerator.noise(pointer1*0.001, pointer2*0.001)

should get you forward.