#version 3.6; #include "colors.inc" #include "functions.inc" global_settings { assumed_gamma 2.0 max_trace_level 5 radiosity { //save data /* brightness 1.0 count 1000 //count 50 error_bound 0.015 gray_threshold 0 low_error_factor 0.2 minimum_reuse 0.015 nearest_count 10 recursion_limit 1 adc_bailout 0.01 max_sample 0.0 media off normal off always_sample 1 pretrace_start 0.08 pretrace_end 0.004 //pretrace_end 0.04 save_file "data.rad" */ //load data pretrace_start 1 pretrace_end 1 load_file "data.rad" error_bound 0.015 recursion_limit 1 always_sample off } } //variables #declare direct = 45; #declare light_origin = <-400,400,200>; #declare BLUR = 0; #declare NORMAL = 1; #declare ORTO = 2; #declare CAMERA = BLUR; //TEXTURES #declare t_spring = texture { pigment { color rgb <0.345098, 0.372549, 0.454902>//*.5 } finish{ diffuse 0.3 ambient 0.0 specular 0.3 reflection { 0.8 metallic } conserve_energy } } #declare t_sphere = texture { pigment { rgb <0.000000, 0.000000, 0.501961> filter .8 transmit .5 } finish { diffuse 0.3 ambient 0.1 specular 0.5 roughness 0.002 brilliance 5 reflection { 0.3, 0.7 metallic } conserve_energy } } // ---------------------------------------- // COMMON OBJECTS #switch (CAMERA) #case (BLUR) camera { location <0.0, 0.5, -4.0> look_at <0.0, 0.0, 0.0> right x*image_width/image_height aperture .3 // [0...N] larger is narrower depth of field (blurrier) blur_samples 200 // number of rays per pixel for sampling focal_point <1.35,.65,-.8> // point that is in focus confidence 0.999 // [0...<1] when to move on while sampling (smaller is less accurate) variance 1/3000 // [0...1] how precise to calculate (smaller is more accurate) angle 65 } #break #case (NORMAL) camera { location <0.0, 0.5, -4.0> look_at <0.0, 0.5, 0.0> right x*image_width/image_height angle 65 } #break #case (ORTO) camera { // orthographic projection using parallel camera rays //orthographic location <-20,30,0> look_at <-20,0,0> angle 120 } #break #end //sphere as skysphere to use finish sphere { 0,100000 texture{ pigment { //rgb <0.000000, 0.317647, 0.466667> rgb .9 scale 100000 } finish { ambient 1 diffuse 0 } } hollow on } light_source{ light_origin <1.000000, 0.980392, 0.917647>*500000 area_light <10, 0, 0> <0, 0, 10> 8, 8 adaptive 1 jitter fade_distance 1 fade_power 2 } light_source{ <20,-20 ,0> SkyBlue*1000 area_light <10, 0, 0> <0, 0, 10> 8, 8 adaptive 1 fade_distance 1 fade_power 2 shadowless } //-------------------------------------------------- //objects #macro spring(inSpringRadius, inMetalRadius, inLength, inOffset) //calculate # of spires #if (inOffset < inMetalRadius) #warning "Offset is less then spring small radius.\nFinal aspect may be not as expected." #end #local Gradient = #if(inSpringRadius > inLength) inSpringRadius + inMetalRadius + 0.1; #else inLength + 0.1; #end #local Period = inLength/inOffset; union { isosurface { function {f_helix1(x,y,z,1,Period,inMetalRadius,inSpringRadius,1,1,0)} accuracy 0.001 max_gradient 2*Gradient contained_by{sphere{ 0,Gradient } } } torus{inSpringRadius,inMetalRadius translate y*-inLength} torus{inSpringRadius,inMetalRadius translate y*inLength} } #end object {union { object{ spring(.5,.05,1,.08) rotate y*35 } difference { sphere {0,.6} sphere {0,.5} translate y*(1+.4) texture {t_sphere} hollow on interior { ior 1.05 } } } translate <1.5,-.75,-.5> texture {t_spring} } object {union { spring(.5,.05,2,.1) difference { sphere {0,.7} sphere {0,.65} translate y*(2+.5) texture {t_sphere} hollow on } } translate <0,-1.75,3> texture {t_spring} } object {union { object { spring(.4,.05,1,.05) rotate y*180 } difference { sphere {0,.65} sphere {0,.52} translate y*(1+.52) texture {t_sphere} hollow on } } translate <-2.3,-.75,1> texture {t_spring} } plane { z, 450 pigment {rgb <0.043137, 0.388235, 0.643137>*.5} hollow on } background {rgb <0.043137, 0.388235, 0.643137>} /*cylinder {<0,-100,0>,<0,100,0>,.012 pigment {color rgb <1,0,0>}} //y axis cylinder {<0,-100,0>,<0,100,0>,.012 pigment {color rgb <0,1,0>} rotate z*-90} //x axis cylinder {<0,-100,0>,<0,100,0>,.012 pigment {color rgb <0,0,1>} rotate x*90} //z axis*/ //sphere {0,1 pigment {rgb <1,0,0>}}