private double[][] generatePerlinNoise(double[][] baseNoise, int octaveCount) {
		int width = baseNoise.length;
		int height = baseNoise[0].length;

		double[][][] smoothNoise = new double[octaveCount][][]; // an array of 2D arrays containing

		//double persistance = 0.5f;

		// generate smooth noise
		for (int i = 0; i < octaveCount; i++) {
			smoothNoise[i] = generateSmoothNoise(baseNoise, i);
		}

		double[][] perlinNoise = new double[width][height];
		for (int i = 0; i < perlinNoise.length; i++) {
			for (int j = 0; j < perlinNoise[i].length; j++) {
				perlinNoise[i][j] = 0;
			}
		}

		double amplitude = 1.0f;
		double totalAmplitude = 0.0f;

		for (int octave = octaveCount - 1; octave >= 0; octave--) {
			amplitude *= getPersistance();
			totalAmplitude += amplitude;

			for (int i = 0; i < width; i++) {
				for (int j = 0; j < height; j++) {
					perlinNoise[i][j] += smoothNoise[octave][i][j] * amplitude;
				}
			}
		}
		
		for (int i = 0; i < width; i++) {
			for (int j = 0; j < height; j++) {
				perlinNoise[i][j] /= totalAmplitude;
			}
		}

		return perlinNoise;
	}