This time two colors are specified for the pulp, PulpMin & PulpMax. The range of colors that can be returned for the pulp are those that lie on the line from PulpMin to PulpMax.

Color(r, theta, z) { //First peturb the radius with a noise function R = r + Noise(r, theta, z); D = R/RingWidth; D = (D - (int)D) * RingWidth; if( D < GrainWidth) return GrainColor; else { R = r + Turbulance(r, theta, z); //some fudging to ensure a number between 0 and 1 factor = (1 + sin(R/lambda)) / 2.0; //use this factor to linearly interpolate between the two colors PulpMin and PulpMax. return Interpolate(GrainMax, GrainMin, factor); } }

This procedure can also be done with the grain color by specifying GrainMin and GrainMax.

The next two images instead of using two colors, PulpMin & PulpMax, uses a repeating set

of 20 colors.

Ring = (int)R / RingWidth;

Ring = Ring % 20;

Interpolation is first between the ring color and the next ring color followed by an of that color and the previous ring color. The factors used for the two interpolations are different and were forced into the range [0, 0.5].