#include "colors.inc" #include "metals.inc" #include "glass.inc" #include "stones.inc" ////////////////////////////////////////////////////////////////// global_settings { ambient_light White radiosity { distance_maximum 100 recursion_limit 2 count 150 error_bound 0.4 } } ////////////////////////////////////////////////////////////////// #declare FAST_TEXTURE=0; #declare FAST_LIGHTSOURCES=0; #declare DEBUG=0; ////////////////////////////////////////////////////////////////// //camera { location <0,5,-15> look_at <0,5,0> } //camera { location <+5,5,-10>*2.5 look_at <0,5,0> } //camera { location <9,9,-20> look_at <0,0,20> } camera { location <8,8,-5> look_at <0,0,100> } //camera { location <20,20,-20> look_at <0,0,20> } //camera { location <2,5,-2> look_at <0,0,0> } #if (DEBUG=1) light_source { <-5,5,-5> color White } light_source { <5,-5,-25> color White } light_source { <5,25,5> color White } #end //plane {y,0 pigment { Blue }} ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// ////////////////////// #declare TUBE_TEXTURE = #if (FAST_TEXTURE=1) texture { pigment { rgbf <0.0,0.3,0.7,1> } } #else texture { pigment { rgbf <0.0,0.3,0.7,1> } normal { bumps 0.2 scale 0.25 } finish { ambient 0.5 specular 1 roughness 0.4 diffuse 0.3 refraction 1 reflection 0.2 } } #end #declare TUBE_INTERIOR= #if (FAST_TEXTURE=1) interior{} #else interior { ior 1.1 caustics 0.5 media { scattering { 5 eccentricity 0.5 } } } #end ////////////////////// #declare EXTERIOR_TUBE_TEXTURE = #if (FAST_TEXTURE=1) texture { pigment { White * 0.75 } } #else texture { pigment { White * 0.75 } normal { wrinkles 0.15 scale 0.05 } finish { specular 0.5 roughness 0.5 ambient 0.05 diffuse 0.3 } } #end ////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////// #macro glowingPipe(r, height, tube_radius, washer_thickness, washer_diameter, ring_thickness, ring_gap, rod_diameter, nb_bubbles, bubble_radius, nb_light_sources) union { // structubes difference { union { // bas cylinder { 0 <0,2*washer_thickness+ring_thickness,0> washer_diameter } cylinder { <0,washer_thickness,0> <0,washer_thickness+ring_thickness,0> 1 } cylinder { <0,washer_thickness+ring_thickness+ring_gap,0> <0,washer_thickness+2*ring_thickness+ring_gap,0> 1 } cylinder { <0,ring_thickness+ring_gap,0> <0,2*washer_thickness+2*ring_thickness+ring_gap,0> washer_diameter } // haut cylinder { <0,height,0>, <0,height-2*washer_thickness-ring_thickness,0>, washer_diameter } cylinder { <0,height-washer_thickness,0> <0,height-washer_thickness-ring_thickness,0> 1 } cylinder { <0,height-washer_thickness-ring_thickness-ring_gap,0> <0,height-washer_thickness-2*ring_thickness-ring_gap,0> 1 } cylinder { <0,height-ring_thickness-ring_gap,0> <0,height-2*washer_thickness-2*ring_thickness-ring_gap,0> washer_diameter } texture { EXTERIOR_TUBE_TEXTURE } } // union cylinder { <0,-0.01,0>, <0,height+0.01,0> , tube_radius+0.001 } } // difference union { #local i=0; #while (i<6) cylinder { <0,washer_thickness+0.01, washer_diameter+(1-washer_diameter)/2> <0,height-washer_thickness-0.01,washer_diameter+(1-washer_diameter)/2> rod_diameter/2 rotate <0,i*60,0> } #declare i=i+1; #end // (i<6) texture { EXTERIOR_TUBE_TEXTURE } } // union union { #if (FAST_LIGHTSOURCES=1) light_source{ <0,height/2,0> color White/2 fade_distance 1 fade_power 2 jitter} #else #local _j = 0; #while ( _j < nb_light_sources ) #local a = radians(rand(r)*360); #local d = rand(r)* tube_radius; #local dx = d * sin(a); #local dy = rand(r)*height; #local dz = d * cos(a); light_source{ color (3*White)/nb_light_sources fade_distance 1 fade_power 2 } #declare _j = _j + 1; #end #end // if (FAST_LIGHT... } // union difference { cylinder{ <0,0,0> <0,height,0> tube_radius texture { TUBE_TEXTURE } interior { TUBE_INTERIOR} } union { #local _j = 0; #while ( _j < nb_bubbles) #local a = radians(rand(r)*360); #local d = rand(r)* (tube_radius-1.5*bubble_radius); #local dx = d * sin(a); #local dy = rand(r)*height; #local dz = d * cos(a); sphere{ 0, bubble_radius translate texture { TUBE_TEXTURE } interior { TUBE_INTERIOR } } #declare _j = _j + 1; #end } } // diff } #end // glowingPipe(...) ////////////////////////////////////////////////////////////////// #macro splinePoint(p1,r1,p2,r2,dt) (2 * pow(dt,3) - 3 * pow(dt,2) +1 ) * p1 + (-2 * pow(dt,3) + 3 * pow(dt,2) ) * p2 + (pow(dt,3)-2 * pow(dt,2)+ dt) * r1 + (pow(dt,3) - pow(dt,2) ) * r2 #end ////////////////////////////////////////////////////////////////// #macro splineWire( p1, r1, p2, r2, slices, wire_radius, shrink) union { // uses Hermite Splines #local ddt=1/slices; #local dt=0; #while (dt<=1.0+0.0001) #local p = splinePoint(p1,r1,p2,r2,dt); #local pp = splinePoint(p1,r1,p2,r2,dt+ddt); #local dp = p-pp; sphere { p wire_radius } cylinder{ p-dp*shrink pp+dp*shrink wire_radius} #declare dt = dt + ddt; #end } #end ////////////////////////////////////////////////////////////////// // // scene // ////////////////////////////////////////////////////////////////// #declare r=seed(121); #declare zz = 0; #while (zz < 10) // gros cables exterieurs #declare i=0; #while (i<10) #declare a = radians(rand(r)*360); #declare a2 = a+(rand(r)-rand(r))*0.5; #declare p1 = < sin(a),cos(a), 0> * 5; #declare r1 = p1; #declare p2 = < sin(a2),cos(a2), 0> * 16; #declare r2 = p2; object { splineWire(p1,r1,p2,r2, 20, 0.2, 0.05) texture { EXTERIOR_TUBE_TEXTURE } translate <0,0,zz*20> } #declare i=i+1; #end//while (i // superellipsoides difference { union { #declare i=0; #while (i<30) superellipsoid { < 0.25, 0.25 > scale <0.25,1,1> texture { EXTERIOR_TUBE_TEXTURE } translate <0,5,0> rotate <0,0, i * 12> translate <0,0,zz*20-2> } superellipsoid { < 0.25, 0.25 > scale <0.25,1,1> texture { EXTERIOR_TUBE_TEXTURE } translate <0,5,0> rotate <0,0, i * 12> translate <0,0,zz*20+2> } #declare i=i+1; #end } union { torus { 5, 0.75 rotate <90,0,0> translate <0,0,zz*20-2> texture { EXTERIOR_TUBE_TEXTURE }} torus { 5, 0.75 rotate <90,0,0> translate <0,0,zz*20+2> texture { EXTERIOR_TUBE_TEXTURE }} } } // difference // tubes torus { 5, 0.75 rotate <90,0,0> translate <0,0,zz*20-2> texture { TUBE_TEXTURE } interior { TUBE_INTERIOR} } torus { 5, 0.75 rotate <90,0,0> translate <0,0,zz*20+2> texture { TUBE_TEXTURE } interior { TUBE_INTERIOR} } #if (FAST_LIGHTSOURCES=0) #declare i=0; #declare nb_lights=15; #while (i+*0.25 color (White/nb_lights) rotate <0,0,rand(r)*360> translate <0,0,zz*20-2> } light_source { <0,5,0>+*0.25 color (White/nb_lights) rotate <0,0,rand(r)*360> translate <0,0,zz*20+2> } #declare i=i+1; #end // while #end // if // gugusses au centre du ring cylinder { <0,0,zz*20-1> <0,0,zz*20+1> 5 texture { EXTERIOR_TUBE_TEXTURE} } cylinder { <0,0,zz*20-3+0.2> <0,0,zz*20+3-0.2> 4.5 texture { EXTERIOR_TUBE_TEXTURE} } ////// // choucroute sur les gugusses au centre du ring /// boites #declare i=0; #while (i<200) box{ <-1,0,-1>, <1,2,1> scale (0.5-rand(r)*0.4) texture {EXTERIOR_TUBE_TEXTURE} translate <0,5,(rand(r)-rand(r))*0.5> rotate <0,0, rand(r)*360 > translate <0,0,zz*20> } #declare i=i+1; #end//while // bunch of wires #declare i=0; #while (i<40) #declare a1 = radians(rand(r)*360); #declare a2 = a1 + (rand(r)-rand(r))*0.25; #declare p1 = < sin(a1), cos(a1), (rand(r)-rand(r))*0.25>*5.5; #declare r1 = p1/2; #declare p2 = < sin(a2), cos(a2), (rand(r)-rand(r))*0.25>*5.5; #declare r2 = -p2/2; #declare p1 = p1+<0,0,zz*20>; #declare p2 = p2+<0,0,zz*20>; object { splineWire( p1,r1,p2,r2, 10, 0.1, 0 ) pigment { rgb *0.5 + <1,1,1>*0.5 } } #declare i=i+1; #end// while #declare i=0; #while (i<6) object { union { #declare j=0; #while (j<12) #local a = radians(j*30); #local p1 = < 1.1*sin(a), 10.5, 1.1*cos(a) >; #local p2 = < 1.5*sin(a), 12, 1.5*cos(a) >; #local r1 = < 1.1*sin(a), 0, 1.1*cos(a) >*2; #local r2 = < 0, 2, 0 >; object { splineWire( p1,r1, p2,r2, 10, 0.1, 0 ) texture {EXTERIOR_TUBE_TEXTURE} } #declare j=j+1; #end// (j< cylinder { <0,10,0> <0,12,0> 1.1 texture {EXTERIOR_TUBE_TEXTURE}} #if (DEBUG=0) ////// glowingPipe(r, 10, 0.6, 0.1, 0.7, 0.25, 0.5, 0.1, 20, 0.05, 10) #end ///// cylinder { <0,0,0> <0,-1,0> 1.1 texture {EXTERIOR_TUBE_TEXTURE}} } translate <0,4,0> rotate <0,0,i*60> translate <0,0,zz*20-10> } #declare i=i+1; #end superellipsoid { <1,0.25> scale <4,4,1> translate <0,0,zz*20-10> texture { EXTERIOR_TUBE_TEXTURE }} #declare i=0; #while (i<36) superellipsoid { <0.25, 0.25> scale <0.3,0.5,0.8> translate <0,3.6,0> rotate <0,0,10*i> translate<0,0,zz*20-10> texture { EXTERIOR_TUBE_TEXTURE}} #declare i=i+1; #end #declare i=0; #while (i<12) superellipsoid { <0.25, 0.25> scale <0.4,1,1.1> translate <0,3.1,0> rotate <0,0,30*i> translate<0,0,zz*20-10> texture { EXTERIOR_TUBE_TEXTURE}} // cables entre les superellipsoides et l'axe principal #declare j=0; #while (j<5) #local p1 = <0,(j/5)+2.5,-1.0>; #local r1 = <0,0,-10>; #local a = radians( (j-2)*10 ); #local p2 = <1.5*sin(a),1.5*cos(a),-4-i/10 >; #local r2 = <-sin(a),-cos(a),0>*5; object { splineWire( p1,r1,p2,r2, 10, 0.05, 0 ) pigment { rgb *0.5 + <0.5,0.5,0.5> } rotate <0,0,i*30> translate <0,0,zz*20-10> } #declare j=j+1; #end // while (j #declare i=i+1; #end // while (i // cables entre les (gros) superellipsoides et l'axe principal #declare i=0; #while (i<50) #local a1 = radians(rand(r)*360); #local p1 = <1.5*sin(a1),1.5*cos(a1),-rand(r)*9>; #local a2 = a1+rand(r)-rand(r); #local p2 = <(3.5-rand(r))*sin(a2),(3.5-rand(r))*cos(a2),-3>; #local r1 = <1.5*sin(a1),1.5*cos(a1),0>*2; //#local r2 = -<1.5*sin(a2),1.5*cos(a2),0>*2; #local r2 = <0,0,10>; object { splineWire( p1,r1,p2,r2, 10, 0.1, 0) translate <0,0,zz*20> //texture { EXTERIOR_TUBE_TEXTURE } pigment { rgb *0.5 + 0.5 } } #declare i=i+1; #end #declare i=0; #while (i<30) box { <-rand(r),1.5+rand(r),-0.1> <+rand(r),4 - rand(r),+0.1> translate <0,0,zz*20-3-rand(r)*0.1> rotate <0,0, rand(r)*360> texture {EXTERIOR_TUBE_TEXTURE} } #declare i=i+1; #end #declare zz=zz+1; #end cylinder{ <0,0,-20> <0,0,400> 1.5 texture { EXTERIOR_TUBE_TEXTURE }} //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// /// tunnel cylinder{ 0 <0,0,400> 16 open hollow texture { EXTERIOR_TUBE_TEXTURE }} #declare zz=-10; #while (zz < 400) //400 #declare offset_a = rand(r)*360; #declare i=0; #while (i<18) union { #declare dy=15-rand(r)*0.75; /* #declare j=0; #while (j<5) #declare p1 = <2*(rand(r)-rand(r)),0.1,0.1+1.3*rand(r)>; #declare r1 = y; #declare p2 = <2*(rand(r)-rand(r)),1,0.1+1.3*rand(r)>; #declare r2 = y; object { splineWire( p1,r1,p2,r2, 10, 0.075, 0) #if (rand(r)<0.3) pigment { rgb <0,0.3,0.7> } finish { ambient 2.0 } #else texture { EXTERIOR_TUBE_TEXTURE } #end } #declare j=j+1; #end // while (j */ #declare j=0; #while (j<10) #local dx = (rand(r)-rand(r))*1.8; #local dz = (rand(r)*1.3) +0.1; cylinder { 0.1 #if (rand(r)<0.1) pigment { rgb <0,0.3,0.7> } finish { ambient 2.0 } #else texture { EXTERIOR_TUBE_TEXTURE } #end } #declare j=j+1; #end box { <-2,0,0> <+2,0.05,1.5> texture { EXTERIOR_TUBE_TEXTURE }} translate <0,dy,zz> rotate <0,0,offset_a+i*20-(rand(r)*5)> } #declare i=i+1; #end #declare zz=zz+2; #end