#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 = 0.000001; #declare tube_base = 0; #declare tube_height = 92+55; #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 gel_thickness = 13; #declare tube_thickness = 3; #declare water_thickness = 9.4; #declare plexi_thickness = 6.35; #declare Total = gel_thickness + tube_thickness + water_thickness + plexi_thickness; #declare FadePower = 1.5; // 1001; #declare Setup = 0; #declare Scene = 1; #declare Render = Scene; #switch (Render) #case (Setup) camera { //orthographic location <0, tube_height+300, -600> look_at <0, tube_height, 0> angle 15 } light_source {<0, tube_height/2, -800> 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 <0.5, 1, 0.5, 0.9>} } } // end of material #declare Water_Mat = material { texture { pigment {rgb <0.25, 0.25, 1>} } } // end of material #declare Plexi_Mat = material{ texture { pigment {rgb <1, 0.5, 0.5>} } } // end of material #break #case (Scene) camera { location <0, tube_height/2, -600> look_at <0, tube_height/2, 0> angle 15 } #declare light_box = box {<-80, -100, Total+1>, <80, 100, Total+2> pigment{color White} } light_source { <0, 0, 0> color rgb 1 area_light 160*x, 200*y 20, 20 adaptive 1 jitter looks_like {light_box} translate z*(Total+2) } #declare MatBubble = material { texture { pigment {color rgbt<0.99, 0.99, 0.99, 0.98>} } // end of texture interior { ior bubble_ior dispersion 1.01 // this simulates dispersion caused refraction dispersion_samples 7 fade_power FadePower //(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 FadePower //(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 FadePower //(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 FadePower //(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 FadePower //(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 0}} #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; #declare All_Bubbles = union { #for (B, 0, Bubbles) Bubble (BubbleArray [B*2], BubbleArray [B*2+1]) #end material {MatBubble} rotate } //===================================================================================== // Creating Gel to fill Glass Tube with voids for the bubbles //===================================================================================== // Creating gel to fill glass #declare GelCyl = difference { merge { sphere { <0, 0, 0>, gel_thickness} // end sphere cylinder{<0, 0, 0>, <0, gel_height, 0>, gel_thickness}// end material {Gel_Mat} } // end merge (gel matrix) object {All_Bubbles} } //===================================================================================== //Creating Glass Tube //===================================================================================== //create hollow cylinder #declare Inner = gel_thickness + epsilon; #declare Outer = gel_thickness + tube_thickness; #declare GlassTube = merge { difference { cylinder { <0, 0, 0>, <0, tube_height, 0>, Outer} cylinder { <0, -epsilon, 0>, <0, tube_height+epsilon, 0>, Inner} } // End difference (hollow cylinder) //create hollow half-sphere difference { difference { sphere { <0,0,0>, Outer} // end sphere sphere { <0,0,0>, Inner} // end sphere } // End difference (Hollow Sphere) #declare Cutter = Outer + epsilon; box {, <1, 1, 1>*-Cutter} } // End Difference (Half-Sphere) // create Lip torus at top of tube torus {Inner+(Outer - Inner)/2, tube_thickness/2 translate <0, tube_height, 0> } // End Torus (Tube Lip) material {Tube_Mat} rotate } // End Merge (Full tube) //===================================================================================== // Creating Water Cylinder around tube //===================================================================================== #declare WaterCyl = difference{ cylinder {<0, -Outer, 0>, <0, tube_height*0.8, 0>, gel_thickness + tube_thickness + water_thickness} //End outer union { cylinder{<0, 0, 0>, <0, tube_height+epsilon, 0>, gel_thickness + tube_thickness + epsilon} //end cylinder for glass tube sphere{<0, 0, 0>, gel_thickness + tube_thickness + epsilon} // end sphere (tube bottom) } //end merge (glass tube inside of water material {Water_Mat} } // End difference of outer water tube //===================================================================================== //Creating Plexiglass Cylinder holding water //===================================================================================== #declare PlexCyl = difference{ cylinder{<0, -Outer, 0>, <0, tube_height*0.9, 0>, Total} //End outer cylinder cylinder{<0, -Outer, 0>, <0, tube_height*0.9+epsilon, 0>, gel_thickness + tube_thickness + water_thickness + epsilon} //End outer cylinder material {Plexi_Mat} } // End difference of outer water tube #if (!Render) GelCyl GlassTube WaterCyl PlexCyl #else union { object {GelCyl} object {GlassTube} object {WaterCyl} object {PlexCyl} //clipped_by {box {<-Total, -Outer, Total>-epsilon, }} } #end