surface FHSpiral2 ( float ts = 0, Ks = .5, Kd = .5, Ka = 1, roughness = .1, frequency = 1, frequency2 = 8, magnitude = .005; color color1 = 1, color2 = color "rgb" (1, 0, 0), specularcolor = 1; ) { point Nf, NN; point V = normalize(-I); color Ct; float ss,tt,msft,mag; if (ts == 0) { ss = s; tt = t; } else { ss = 1-t; tt = s; } msft = mod(ss+frequency*tt, 1); Ct = mix(color1, color2, smoothstep(.49, .51, msft)); mag = sin(2*PI*frequency2*msft) *smoothstep(.35, .4, noise(128*ss*(1-ss),128*tt*(1-tt))); NN = faceforward(normalize(N), I); Nf = normalize(calculatenormal(P+magnitude*mag*mag*NN)); Oi=Os; Ci=Os*(Ct * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks *specular(Nf, V, roughness) ); }