surface test_ray_names(float Kd = 1, Ka = 1, samplecone = 0, samples =10) { vector i = normalize(I); normal n = normalize(N); normal nf = faceforward(n, i); color hitcol = 0; color surfcolor = (0.5,0.5,0.5); float sc = radians(samplecone); Ci = 0; Oi = Os; vector rayRef = reflect(i,nf); float numhits = 0; float yesReflect = 0; gather("illuminance", P, rayRef, sc, samples, "label", "reflect_ray", "surface:yes_reflect", yesReflect, "surface:Ci", hitcol) { if(yesReflect) Ci += hitcol; else Ci = Kd * surfcolor * diffuse(nf); numhits += 1; } Ci = (Ci / numhits); Ci = Ci * Cs; Oi = 1; }