Flynn52

Flynn_Glass-Balls

Jun 1st, 2017
600
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // *************************************************************
  3. // *  Flynn_Glass-Balls  (c) 2017 by Flynn                     *            
  4. // *************************************************************
  5.  
  6. #version 3.7;
  7.  
  8. #include "glass.inc"
  9. #include "colors.inc"
  10. global_settings
  11. {
  12.   adc_bailout 0.003922
  13.   ambient_light <1.0,1.0,1.0>
  14.   assumed_gamma 2.2
  15.   irid_wavelength <0.247059,0.176471,0.137255>
  16.   max_trace_level 25
  17.   number_of_waves 15
  18. }
  19.  
  20.  
  21. // *** Camera ***
  22.  
  23. camera {
  24.     //location  <0, 10.5,-100>
  25.     //location  <-20, 120,-90>
  26.     //location  <-40, 50,-160>
  27.     location  <-60,  5,-170>
  28.     direction <0,  0,   1>
  29.     up        <0,  1,   0>
  30.     right   <4/3,  0,   0>
  31.     look_at <0, 75, 0>
  32. }
  33.  
  34. // *** Light-Sources ***
  35. light_source {<30, 120, 0> colour <1.5,1.5,1.5>
  36.     fade_distance 90
  37.     fade_power 2
  38. }
  39.  
  40. // *** Background ***
  41.  
  42. sky_sphere {
  43.      pigment {
  44.         gradient y
  45.         color_map {
  46.             [0.0 Gray50 ]
  47.             [1.0 Gray15 ]
  48.         }
  49.     }
  50. }
  51.  
  52. // *** Texture for the Brick-Room ***
  53.  
  54. #declare Brick =
  55. texture {
  56.     pigment { brick Gray80, rgb<0.65, 0.3, 0.25> brick_size <3,1,2> mortar 0.15 }
  57.     normal { brick -10 brick_size <3,1,2> mortar 0.175 ramp_wave}
  58.     finish {
  59.         ambient 0.0
  60.         diffuse 0.8
  61.     }
  62.     scale 6
  63. }
  64.  
  65. // *** Geometry ***
  66.  
  67. // ** The Brick-Room **
  68. plane { x,-90 texture { Brick rotate y*90 }}               // left wall
  69. plane { x, 90 hollow on texture { Brick rotate y* 90}}     // right wall
  70. plane { z, 70 hollow on texture { Brick }}                 // back wall
  71. plane { y, 0 texture { Brick } translate -y*8 }            // floor
  72.  
  73.  
  74. // ** The Glass-Balls **
  75.  
  76. // * Declare the variables for the random position of the balls (x,y and z-axis)
  77. #declare Rx = seed(now * 51);
  78. #declare Ry = seed(now * 121);
  79. #declare Rz = seed(now * 242);
  80. #declare iRadiusRND = seed(now * 368);
  81.  
  82. #declare iCounter   = 0;
  83. #declare iIncrement = 1;    //Iterations
  84. #declare iLoopEnd   = 300;  // This is for how many Balls will be created
  85. #declare irandMulti = seed(now * 151) + 150;    
  86.  
  87. #while (iCounter < iLoopEnd)
  88.  #declare RVx = rand(Rx) * irandMulti;
  89.  #declare RVy = rand(Ry) * irandMulti;
  90.  #declare RVz = rand(Rz) * irandMulti;
  91.  #declare iRadius = rand(iRadiusRND) * 20; // how big is a GlassBall
  92.  
  93.  sphere
  94.  {
  95.     <RVx,RVy,RVz>, iRadius  
  96.     texture
  97.     {
  98.         pigment { White filter 0.95}
  99.         finish { F_Glass3 }
  100.     }
  101.    
  102.     interior
  103.     {I_Glass
  104.         caustics 1
  105.     }
  106.    
  107.     photons
  108.     {
  109.         target 0.5
  110.         //target 1.0
  111.         refraction on
  112.         reflection on
  113.     }
  114.        
  115.  }
  116.      
  117.      // *** a Debug-Line ***
  118.      #debug concat("iCounter: ", str(int(iCounter),1,1), "  RVx: ", str(RVx,1 ,1) , " RVy: ", str(RVy,1 ,1) , " RVz: ", str(RVz,1 ,1), " iRadius: ", str(iRadius,1,1) ,"\n")
  119.  
  120.      #declare iCounter=iCounter+iIncrement;
  121. #end
RAW Paste Data