//blended cells, wanted to do for ages but couldn't see how #include "transforms.inc" global_settings { assumed_gamma 1 } //code to pick a nice colour #macro vpow(V,P) #end #macro bits(a,p,n) //convert a series of bits to an integer, (a>>p)&((1<,2.2) //vpow compensates for gamma #end //my pattern, each unit square must use a different colour #declare mycells_p = pigment { //this is the cells-based patten we want to blur pigment_pattern { checker pigment { rgb 0 }, //gaps between the cells, when sliced at the correct angle they look like hexagons with triangular gaps between, which look like circles when blurred pigment { cells } } colour_map { //pick the most visually distinct colours I can #local f=0; #while ( f <= 16 ) #local col = pickcolour(f); [f/16,(f+1)/16 color col color col] #local f=f+1; #end } } //macro version of the pattern, offset the unit squares pattern (done in a macro in case I want cells picking patterns) #macro mycells(Offset) mycells_p translate Offset + .001 //cells don't quite line up with the blend gradient, but .001 completely fixes it!!! I'm a bit freaked out by that #end //blur the pattern #declare blurriness = 1; #macro blend(V) pigment_pattern { //gradient controlling the blend gradient V //phase .001 //cells and gradient don't quite line up, but this completely fixes it!!! I'm a bit freaked out by that //mess with this colour map to reduce blend region colour_map { [.5-blurriness/2 rgb 0] [.5+blurriness/2 rgb 1] } } cubic_wave #end #declare blendedcells = pigment { blend(x) pigment_map { [0 blend(y) pigment_map { [0 blend(z) pigment_map { [0 mycells(<1,1,1>)] [1 mycells(<1,1,0>)] } ] [1 blend(z) pigment_map { [0 mycells(<1,0,1>)] [1 mycells(<1,0,0>)] } ] } ] [1 blend(y) pigment_map { [0 blend(z) pigment_map { [0 mycells(<0,1,1>)] [1 mycells(<0,1,0>)] } ] [1 blend(z) pigment_map { [0 mycells(<0,0,1>)] [1 mycells(<0,0,0>)] } ] } ] } } //test: plane { -z, 0 pigment { blendedcells translate .0 Reorient_Trans(<1,1,1>,z) scale .5 } finish { ambient 1 diffuse 0 }//1 } translate z*4 }