Listing 1

// Normalize the height value to a
// color index between 0 and NUMBER_OF_COLORS - 1
float index = (NUMBER_OF_COLORS - 1)*((100f - elevation) / 100f);
float delta = 1.5f *(float)ImprovedNoise.noise(row/3.7, elevation/7.4, col/3.7);
// Nudge the color index with the noise 
int answer = Math.round(index + delta);
// Clamp the index value
if(answer < 0) answer = 0;
if(answer > NUMBER_OF_COLORS - 1) answer = NUMBER_OF_COLORS - 1;

Listing 2

// Create the texture for the sphere
Texture2D texture =
	new Texture2D(
		Texture2D.BASE_LEVEL,
		Texture2D.RGBA,
		IMAGE_SIZE,
		IMAGE_SIZE);
texture.setImage(0, getImage());
texture.setEnable(true);
// Set the optional quality settings 
texture.setMagFilter(Texture2D.NICEST);
texture.setMinFilter(Texture2D.NICEST);
appearance.setTexture(texture);

Listing 3

// x = column, y = row, z = static #
double noise = noise(x, y, z) * 15.0;
double grain = noise - Math.floor(noise);
int red = 71 + (int) (164.0 * grain);
int green = 34 + (int) (74.0 * grain);
int blue = 34 + (int) (24.0 * grain);

Listing 4

IndexedTriangleStripArray geometry =
    new IndexedTriangleStripArray(
            vertexCount,
            GeometryArray.COORDINATES
            | GeometryArray.NORMALS
            | GeometryArray.BY_REFERENCE,
            indexCount,
            stripCounts);

Listing 5

static public double fBm(
    double x,
    double y,
    double z,
    int H,
    int octaves) {
    double answer = 0;
    for (int i = 0; i < octaves; i++) {
        answer = answer + noise(x, y, z) / (1 << H * i);
        x = x * 2;
        y = y * 2;
        z = z * 2;
    }
    return answer;

Listing 6

setCapability(Shape3D.ALLOW_GEOMETRY_READ);
Geometry geometry = getGeometry();
geometry.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
geometry.setCapability(GeometryArray.ALLOW_NORMAL_WRITE);
geometry.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);

Listing 7

double turbulance = ImprovedNoise.turbulance(x, y, z, OCTAVES);
double color = Math.min(192 * turbulance, 192);
int red = 255 - (int) (0.3 * color);
int green = 192 - (int) (color);
int blue = 0;

Additional Source Code - Zip file format ~25.4 KB