public void smooth(float np, int radius) {
        if (np < 0 || np > 1) {
            return;
        }
        if (radius == 0)
            radius = 1;
        
        for (int x = 0; x < size; x++) {
            for (int y = 0; y < size; y++) {
                int neighNumber = 0;
                float neighAverage = 0;
                for (int rx = -radius; rx <= radius; rx++) {
                    for (int ry = -radius; ry <= radius; ry++) {
                        if (x+rx < 0 || x+rx >= size) {
                        continue;
                        }
                        if (y+ry < 0 || y+ry >= size) {
                            continue;
                        }
                        neighNumber++;
                        neighAverage += heightData[(x+rx) + (y+ry) * size];
                    }
                }

                neighAverage /= neighNumber;
                float cp = 1 - np;
                heightData[x + y * size] = neighAverage * np + heightData[x + y * size] * cp;
            }
        }
    }
Smooth the terrain. For each node, its X (determined by radius) neighbors' heights
are averaged and will influence node's new height
to the extent specified by <code>np</code>.

You must first load() the heightmap data before this will have any effect.

@param np
         To what extent neighbors influence the new height:
         Value of 0 will ignore neighbors (no smoothing).
         Value of 1 will ignore the node old height.
jme3-terrain/src/main/java/com/jme3/terrain/heightmap/AbstractHeightMap.java