public void erodeTerrain() {
        //erode left to right
        float v;

        for (int i = 0; i < size; i++) {
            v = heightData[i];
            for (int j = 1; j < size; j++) {
                heightData[i + j * size] = filter * v + (1 - filter) * heightData[i + j * size];
                v = heightData[i + j * size];
            }
        }

        //erode right to left
        for (int i = size - 1; i >= 0; i--) {
            v = heightData[i];
            for (int j = 0; j < size; j++) {
                heightData[i + j * size] = filter * v + (1 - filter) * heightData[i + j * size];
                v = heightData[i + j * size];
                //erodeBand(tempBuffer[size * i + size - 1], -1);
            }
        }

        //erode top to bottom
        for (int i = 0; i < size; i++) {
            v = heightData[i];
            for (int j = 0; j < size; j++) {
                heightData[i + j * size] = filter * v + (1 - filter) * heightData[i + j * size];
                v = heightData[i + j * size];
            }
        }

        //erode from bottom to top
        for (int i = size - 1; i >= 0; i--) {
            v = heightData[i];
            for (int j = 0; j < size; j++) {
                heightData[i + j * size] = filter * v + (1 - filter) * heightData[i + j * size];
                v = heightData[i + j * size];
            }
        }
    }
<code>erodeTerrain</code> is a convenience method that applies the FIR
filter to a given height map. This simulates water erosion.
jme3-terrain/src/main/java/com/jme3/terrain/heightmap/AbstractHeightMap.java