/* Pete Hriso Assignment #5 part 1 */ #include "rmannotes.sl" surface proceed1(float Ks=.5, Kd=.5, freq = 6, fuzz = .05; float Ka=1, roughness=.1; color specularcolor=1) { color test = color (.787, 0, 0); color blue = color (.242, 0, .682); color orchid = color (.545, .278, .537); color green1 = color (0, 1, 0); color green2 = color (0, 1, .348); color lavender = color (.513, 1, .513); color lavender2 = color (.124, .575, .124); color black = color (.2, .1, .3); color idont = color (.764, 0 , .567); color paper, ink; float paper_opac, ink_opac; float ss, tt; float row, col; point center, Nf, V; float radius; float d; float width; float disk, ring; color blood = spline(t,test, test, black ,blue, blue); color flood = spline(t,lavender, lavender, black, lavender2, lavender2 ); /* paper */ paper = color (0, 0, 0); paper_opac = 1; /* init */ Nf = faceforward( normalize(N), I); V = -normalize(I); /* layer #1 */ ss = repeat(s, 4); tt = repeat(t, 4); center = (0.5, 0.5, 0); radius = 0.5; width = 0.2; d = distance(center, (ss, tt, 0)); ring = pulse(radius - width / 2, radius + width / 2, fuzz, d); ink = mix(mix(lavender, green1, s),mix(lavender2, green2, s), t); ink_opac = ring * .6; paper = mix(paper, ink, ink_opac); /* layer #2 */ rotate2d(s, t, radians(45), 0.5, 0.5, ss, tt); ss = repeat(ss, freq); tt = repeat(tt, freq); col = whichtile(ss, freq); row = whichtile(tt, freq); if (even(row)) ss = mod(s * freq + .5 , 1); else ss = repeat(ss, freq + .5); tt = repeat(tt, freq ); ink = spline(t,green1, green1, lavender, green2, green2); ink_opac = pulse(.35, .65, fuzz, ss); paper = mix(paper, ink, ink_opac); /* plastic illum for all layers */ paper = paper * Ka * ambient () + paper * Kd * diffuse (Nf) + specularcolor * Ks * specular(Nf, V, roughness); /* output! */ Oi = paper_opac; Ci = paper_opac * paper; }