/*Wooksang's shader*/ #include "rmannotes.sl" surface construction_end_line( float Ks = 0.5, Kd=0.5, Ka = 0.1,roughness=0.1; color first = color(0.740,0.028,0.014); color second = color(0.709,0.768,0.768); color third = color(0.496,0.473,0.475); color forth = color(0.089,0.090,0.260); color specularcolor = 1; varying point Pr = 0) { /*basic setting*/ color surface_color, layer_color=color(1,1,1); float surface_opac, layer_opac; float r,freq=5; float dust=0; vector V; normal Nf; point PP,QQ; Nf=faceforward(normalize(N),I); V=-normalize(I); surface_color =0; surface_opac = 0; /* layer #1 */ surface_color = first; PP = transform("shader", P); PP+= noise(PP*4+3)*0.5; r = distance (point (0,ycomp(PP),zcomp(PP)),point(1,1,1)); r = repeat(r+snoise(r*2),freq); layer_color = second; layer_opac = smoothstep(0.55,0.65,r)-smoothstep(0.75,0.85,r); surface_color = blend(surface_color, layer_color, layer_opac); /* Layer #2 */ layer_color = third; QQ = transform("shader", P); QQ += noise(QQ*2+2)*0.5; r = distance (point (0,ycomp(QQ),zcomp(QQ)),point(1,1,1)); r = repeat(r+snoise(r*2),freq); layer_opac = smoothstep(0.55,0.65,r)-smoothstep(0.75,0.85,r); surface_color = blend(surface_color, layer_color, layer_opac); /* layer #0 */ layer_color = forth; PP = transform("shader", P); PP+= noise(PP*4)*0.5; r = distance (point (xcomp(PP),0,zcomp(PP)),point(1,1,1)); r = repeat(r+snoise(r*4),40); layer_opac = smoothstep(0.55,0.65,r)-smoothstep(0.75,0.85,r); surface_color = blend(surface_color, layer_color, layer_opac); Ci=surface_color*(Ka*ambient()+Kd*diffuse(Nf))+specularcolor*Ks*specular(Nf,V,roughness)*dust; }