#version 3.8; //Files with predefined colors and textures #include "colors.inc" #include "glass.inc" #include "stones.inc" global_settings { assumed_gamma 1.0 max_trace_level 50 } #declare epsilon = .0001; #declare tube_base = -55; #declare tube_height = 92; #declare tube_rinner = 13; #declare tube_router = 16; #declare tube_lip_width = 2; #declare tube_rotation_x = 0; #declare tube_rotation_y = 2*clock; #declare tube_rotation_z = 0; #declare water_router = 25.4; #declare plexi_router = 31.75; #declare gel_height = 0.9*tube_height; #declare bubble_r = 0.8; #declare bubble_ior = 1.0; #declare Setup = 0; #declare Scene = 1; #declare Render = Setup; #switch (Scene) #case (Setup) camera { location <0, 500, 0> look_at <0, 0, 1> angle 15 } light_source {<0, 600, 0> rgb 1} #declare MatBubble = material { texture { pigment {rgb x+z} } } #declare Tube_Mat = material { texture { pigment { rgb <1, 1, 1>} } } // end of material #declare Gel_Mat = material { texture { pigment { rgbt <1, 1, 1, 0.9>} } } // end of material #declare Water_Mat = material { texture { pigment {rgb <0.5, 0.5, 1>} } } // end of material #declare Plexi_Mat = material{ texture { pigment {rgb <1, 0.5, 0.5>} } } // end of material #break #case (Scene) camera { location <000,000,-500> look_at <0,0,1> angle 15 } #declare light_box = box {<-80, -100, 20>, <80, 100, 21> pigment{color White} } light_source { <0, 0, 100> color rgb 1 area_light 160*x, 200*y 20, 20 adaptive 1 jitter looks_like {light_box} } #declare MatBubble = material { texture { pigment {color rgbt<.99,.99,.99,0.98>} //normal { bumps 0 scale 0.025 } finish { phong .001 } } // end of texture interior { ior bubble_ior dispersion 1.01 // this simulates dispersion caused refraction dispersion_samples 7 fade_power 1001 //(0=off) (realistic: 1~2, >=1000 ->realistic exponential attenuation function will be used!) } // end of interior } // end of material #declare Tube_Mat = material{ texture { pigment{ color rgbt<.99,.99,.99,0.99>} //normal { bumps 0 scale 0.025 } finish { phong .99} } // end of texture interior{ ior 1.56 dispersion 1.0 // this simulates dispersion caused refraction dispersion_samples 7 fade_power 1001 //(0=off) (realistic: 1~2, >=1000 ->realistic exponential attenuation function will be used! caustics 0.0 } // end of interior } // end of material #declare Gel_Mat = material{ texture { pigment{ color rgbt<.99,.99,.99,0.98>} //normal { bumps 0 scale 0.025 } finish { phong .001 } } // end of texture interior{ ior 1.405 dispersion 1.01 // this simulates dispersion caused refraction dispersion_samples 7 fade_power 1001 //(0=off) (realistic: 1~2, >=1000 ->realistic exponential attenuation function will be used! caustics 0.0 } // end of interior } // end of material #declare Water_Mat = material{ texture { pigment{ color rgbt<.99,.99,.99,0.98>} //normal { bumps 0 scale 0.025 } finish { phong .001 } } // end of texture interior{ ior 1.33 dispersion 1.01 // this simulates dispersion caused refraction dispersion_samples 7 fade_power 1001 //(0=off) (realistic: 1~2, >=1000 ->realistic exponential attenuation function will be used! caustics 0.0 } // end of interior } // end of material #declare Plexi_Mat = material{ texture { pigment{ color rgbt<.99,.99,.99,0.98>} //normal { bumps 0 scale 0.025 } finish { phong .001 } } // end of texture interior{ ior 1.495 dispersion 1.01 // this simulates dispersion caused refraction dispersion_samples 7 fade_power 1001 //(0=off) (realistic: 1~2, >=1000 ->realistic exponential attenuation function will be used! caustics 0.0 } // end of interior } // end of material #break #end // end Switch block sky_sphere {pigment {rgb 1}} #macro Bubble (Loc, Size) sphere {Loc, Size} #end //===================================================================================== // Creating bubbles that go into gel //===================================================================================== #declare BubbleArray = array mixed { < 3.940, - 7.554, -4.927>, bubble_r, <-1.530, 35.605, -2.926>, bubble_r, <-1.271, 40.873, 2.981>, bubble_r, < 2.972, -36.206, -1.126>, bubble_r, < 8.863, -12.984, 3.351>, bubble_r, } #declare Bubbles = dimension_size (BubbleArray, 1)/2-1; union { #for (B, 0, Bubbles) Bubble (BubbleArray [B*2], BubbleArray [B*2+1]) #end material {MatBubble} rotate } //===================================================================================== //Creating Glass Tube //===================================================================================== //create hollow cylinder #declare GlassTube = union { difference { cylinder { <0,(tube_base-epsilon),0>, <0,tube_height,0>, tube_router} cylinder { <0,(tube_base-2*epsilon),0>, <0,tube_height+epsilon,0>, tube_rinner} } // End difference (hollow cylinder) //create hollow half-sphere difference { difference { sphere { <0,0,0>, tube_router } // end sphere sphere { <0,0,0>, tube_rinner} // end sphere } // End difference (Hollow Sphere) box {<-2*tube_router, 0, -2*tube_router>, < 2*tube_router, 2*tube_router, 2*tube_router >} translate <0,tube_base,0> } // End Difference (Half-Sphere) // create Lip torus at top of tube torus {(tube_router+ tube_rinner)/2, tube_lip_width translate <0,tube_height,0> } // End Torus (Tube Lip) material {Tube_Mat} rotate } // End Merge (Full tube) GlassTube //===================================================================================== // Creating Gel to fill Glass Tube with voids for the bubbles //===================================================================================== // Creating gel to fill glass #declare GelCyl = union { sphere { <0,tube_base,0>, tube_rinner-epsilon} // end sphere cylinder{<0,tube_base,0>, <0,gel_height,0>, tube_rinner-epsilon}// end material {Gel_Mat} } // end merge (gel matrix) GelCyl //===================================================================================== // Creating Water Cylinder around tube //===================================================================================== #declare WaterCyl = difference{ cylinder {<0,tube_base-tube_router,0>,<0,tube_height*.8,0>, water_router} //End outer union { cylinder{<0,tube_base,0>, <0,tube_height+epsilon,0>, tube_router+epsilon} //end cylinder for glass tube sphere{<0,tube_base,0>, tube_router+epsilon} // end sphere (tube bottom) } //end merge (glass tube inside of water material {Water_Mat} } // End difference of outer water tube WaterCyl //===================================================================================== //Creating Plexiglass Cylinder holding water //===================================================================================== #declare PlexCyl = difference{ cylinder{<0,tube_base-tube_router,0>,<0,tube_height*.9,0>, plexi_router} //End outer cylinder cylinder{<0,tube_base-tube_router-epsilon,0>,<0,tube_height*.9+epsilon,0>, water_router+epsilon} //End outer cylinder material {Plexi_Mat} } // End difference of outer water tube PlexCyl