/* caustic.sl - Caustic shader by Stuart Ramsden * Sums brightness contributions to a surface, accounting for attenuation * induced by focusing. * The max and min values are highly dependant on the rendering geometry; * uncomment the printf line and inspect the numbers for appropriate values. */ surface caustic(float brightness = 1.0; float maxval = 80.0; float minval = 10.0) { float lu,lv; /*printf("du: %g dv: %g\n",length(dPdu), length(dPdv)); */ lu = 1-smoothstep(minval,maxval,length(dPdu)); lv = 1-smoothstep(minval,maxval,length(dPdv)); Ci = 0.4*(lu*lu*lv*lv)*brightness; Oi = 0; }