/* test blend parameter color shader */ surface col_blend(float Kd = 1, /* basic brightness */ blend = 1; color color1 = (1,1,1), color2 = (0,0,0)) { color surfcolor; /* make a copy of the surface normal one unit in length */ normal n = normalize(N); normal nf = faceforward(n, I); /* set the apparent surface opacity */ Oi = Os; surfcolor = mix(color1, color2, blend); if(n == nf){ surfcolor = mix(color2,color1, blend); } /* calculate the diffuse lighting component */ color diffusecolor = Kd * diffuse(nf); /* STEP 4 - calculate the apparent surface color */ Ci = Oi * Cs * surfcolor * diffusecolor; }