surface
rmarble(
	float Ks=.4, float Kd=.6, float Ka=.1, float roughness=.1,
	float veining = 1,
	color specularcolor=1)
{
	point PP;
	float cmi;
	normal Nf;
	vector V;
	color diffusecolor ;
	float pixelsize, twice, pixscale, weight, turbulence;

	Nf = faceforward( normalize(N), I);
	V = -normalize(I);

	PP = transform("shader",P) * veining;
	PP = PP/2;	/* frequency adjustment (S-shaped curve) */
	pixelsize = sqrt(area(PP)); twice = 2 * pixelsize;

	/* compute turbulence */
	turbulence = 0;
	for (pixscale = 1; pixscale > twice; pixscale /= 2) {
		/**** This function is different - abs() and -0.5 ****/
		turbulence += pixscale * abs(noise(PP/pixscale)-0.5);
	}
	/* gradual fade out of highest freq component near visibility limit */
	if (pixscale > pixelsize) {
		weight = (pixscale / pixelsize) - 1;
		weight = clamp(weight, 0, 1);
		/**** This function is different - abs() and -0.5 ****/
		turbulence += weight * pixscale * abs(noise(PP/pixscale)-0.5);
	}
	/*
	 * turbulence now has a range of 0:2, but its values actually
	 * tend strongly to lie around 0.75 to 1.
	 */

	/**** This is different - no multiply by 4 and subtract 3 ****/
	cmi = turbulence;
	cmi = clamp(cmi, 0, 1);
	color ramp[8] = {
		color (0.8, 0.2, 0.05),
		color (0.8, 0.2, 0.05),
		color (0.8,0.5,0.3),
		color (0.6,0.594,0.58),
		color (0.3,0.3,0.4),
		color (0.05, 0.05, 0.1),
		color (0.8,0.79,0.77),
		color (0.8,0.8,0.79)
		};

	diffusecolor = spline("catmull-rom", cmi, ramp);
	/* use color spline to compute basic color */
	C = diffusecolor * (Ka*ambient() + Kd*diffuse(Nf));
	/* add in specular component */
	C = opacity * (C + specularcolor * Ks * specular(Nf,V,roughness));
}
