//crackle based circuit board //by tek //rough explanation: // Take a crackle pigment, using metric 1 // draw the edges as wires, and the middle bit as green board. // now, the clever bit, repeat the pattern 5 times in a direction chosen using a solid version of the pattern! // i.e. take the value of the solid pattern as an angle, to decide what direction to repeat in. //hey, like I said, rough! #version 3.5; //scene controls #declare boFocalBlur = off; #declare fBmod = 1/0.7; //adjusts the brightness of some stuff in the scene. //includes #include "functions.inc" #include "rad_def.inc" //global set up global_settings { max_trace_level 5 radiosity { Rad_Settings(Radiosity_Fast, off, off) } } #default { finish { diffuse 1/fBmod ambient 0 } } //textures #declare gnRepeats = 4; #declare gfRepeatDist = 0.10; #declare gfWireWidth = 0.04; #declare nMetric = 1; #declare f_CircuitWire = function { pigment { crackle metric nMetric colour_map { [0 rgb 0] [1 rgb 1] } } } #declare f_CircuitSolid = function { pigment { crackle solid metric nMetric colour_map { [0 rgb 0] [1 rgb 1] } } } #declare f_CircuitRepeated = function(x,y,z, fOffsetX,fOffsetY,fOffsetZ) { #local nRepeat = 0; #while ( nRepeat < gnRepeats ) min ( f_CircuitWire(x - fOffsetX*nRepeat, y - fOffsetY*nRepeat, z - fOffsetZ*nRepeat).red, #local nRepeat = nRepeat + 1; #end //repeat loop 1.0 //close brackets #local nRepeat = 0; #while ( nRepeat < gnRepeats ) ) #local nRepeat = nRepeat + 1; #end //repeat loop } #declare f_CircuitRepeatedInterface = function(x,y,z, fAngle) { f_CircuitRepeated(x,y,z, gfRepeatDist*cos(fAngle), 0, gfRepeatDist*sin(fAngle)) } #declare f_Circuit = function { f_CircuitRepeatedInterface(x,y,z, f_CircuitSolid(x,y,z).red*pi*2) } #declare tWire = texture { pigment { rgb <3,2,1>/3 } finish { diffuse 0.3/fBmod reflection { 0.3,0.8 } conserve_energy specular 1 roughness 0.03 } } #declare tBoard = texture { pigment { rgbft <0,1,0.4,0,0.3> } finish { diffuse 0.3/fBmod reflection { 0.2 } specular 0.2 roughness 0.1 conserve_energy } } #declare tCrackCircuit = texture { function { f_Circuit(x,y,z) } texture_map { [gfWireWidth tWire] [gfWireWidth tBoard] } } //the scene camera { #declare fOrthoSize = 10; //mothers day card! #declare image_dim = sqrt(image_width*image_height); //kind of average dimension right x*image_width/image_dim*fOrthoSize up y*image_height/image_dim*fOrthoSize direction z*fOrthoSize*0.5 location <2,1,-3> look_at 0 #if (boFocalBlur) aperture 0.1 // [0...N] larger is narrower depth of field (blurrier) blur_samples 40//16 // number of rays per pixel for sampling focal_point 2*vnormalize(<2,1,-3>) // point that is in focus confidence 0.99 // [0...1] when to move on while sampling (smaller is less accurate) variance 1/255 // [0...1] how precise to calculate (smaller is more accurate) #end } #declare gvSunDir = vnormalize(<2,3,1>); sky_sphere { pigment { bozo scale 0.7 colour_map { [0 rgb <1,2,3>/10] [1 rgb 1+<3,2,1>/10] } } } light_source { gvSunDir*10000 rgb 1 //area_light x*100,y*100,8,8 circular orient } superellipsoid { <0.1, 0.1> scale 1.5 texture { tCrackCircuit scale 0.35 } rotate <-30,0,0> }