/* cs184 */ /* cs184-cg, cs184-dq */ surface mat ( color dot_color1 = color(0.8, 0.7, 0.9); ) { float radius1 = 0.2; float Kd = 0.7; float Ka = 0.7; point p=(0,0,0); float px = xcomp(p); float py = ycomp(p); float pz = zcomp(p); float x = xcomp(P); float y = ycomp(P); float z = zcomp(P); float len = /*sqrt (pow(x,2) + pow(z,2));*/length(P); point Nf = faceforward( normalize(N), I); if ((mod(px-x, 0.2) > 0 && mod(px-x, 0.2) <= radius1 * (1+cos(10*len)) && mod(pz-z, 0.2) > 0 && mod(pz-z, 0.2) <= radius1 * (1+sin(10*len)))) { Ci = dot_color1; } else Ci = 1-dot_color1; Ci = Ci * (Ka * ambient() + Kd * diffuse(Nf)); }