#include "metals.inc"
#include "colors.inc"
#include "skies.inc"
#declare ATSA = 0
#declare CLOUDS = 1
#declare BLOB = 0
#declare TUNNEL = 1

global_settings {
 adc_bailout 0
 max_trace_level 60
// max_intersections 256
 ambient_light 0
}

#if (CLOUDS = 1)
sky_sphere {
 pigment { P_Cloud1 color_map {[0 rgb <0, 0, .1>] [1 rgb <.8, .8, .8>]} scale .1} 
}
#end

background {color <.1, .1, .8>}

#declare FD=2
#declare FP=1
light_source { <5,5,-5> color rgb <0,0,1> fade_distance FD fade_power FP
 looks_like { 
  sphere {0, .5 pigment { color rgbt <.5, .5, 1, 1> } finish {phong 1 refraction 1 ior 1.3} }
 }
}
light_source { <0,5,-0> color rgb <0,1,0> fade_distance FD fade_power FP
 looks_like { 
  sphere {0, .5 pigment { color rgbt <.5, .5, 1, 1> } finish {phong 1 refraction 1 ior 1.3} }
 }
}
light_source { <-5,5,-4> color rgb <1,0,0> fade_distance FD fade_power FP
 looks_like { 
  sphere {0, .5 pigment { color rgbt <.5, .5, 1, 1> } finish {phong 1 refraction 1 ior 1.3} }
 }
}

#if (BLOB = 1)
blob { threshold .95

 sphere {<0, .5, 0>, 1, 1}
 sphere {<1+1*cos(clock*6.28*3), 0, 0>, 1, 1}
 sphere {<-.9+1.1*sin(clock*6.28*2), .8, 0>, 1, 1}
 sphere {<-1, 0, 0>, 1, 1}
 sphere {<0, -1+1*sin(clock*6.28*1.2), 0>, 1, 1}

 pigment {color rgb <.2,.2,.2>}
 finish {phong 2 reflection 1 }

 scale <10, 4, 2>
 rotate <90, 0, 0>
 rotate <0, clock*360, 0>
 normal {bumps .05 scale .7}
}
#end

#if (ATSA = 1)
box { 0, <1, 1, .00001>
   pigment { image_map { tga "atsa.tga"  } }
   translate <-.5, 0, 0>
   scale <3, 4, 1>
}
#end

plane {y,0
 pigment {checker  color White*.5 color White}
// texture { T_Silver_3D normal {crackle 1 frequency 1 scale 4} }
}

#if (TUNNEL = 1)
#declare A=-200
#while (A < 200)
#declare RAD=.6+.4*sin(clock*30+A*.5)
torus {10, RAD
 rotate <0, 0, 90>
 scale <1, 1, 1.5>
 translate <A*6, 0, 0>
 pigment {color rgbt <1, 1, 1, 0>}
 finish {phong 1}
 normal { bumps .5}
}
#declare A = A + 1
#end
#end /* tunnel */

#declare LA = 400-clock*400
light_source { <LA,.4+abs(5.5*cos(clock*6.28*4)),0> color White fade_distance FD fade_power FP
 looks_like { 
  sphere {0, .5 pigment { color rgbt <1, 1, 1, .8> } finish {phong 1 refraction 1 ior 1.3} }
 }
}

light_source { y*1000 color White*.1}

camera { location <LA+70*cos(3.14*clock), 8, -3>
         right <640/240, 0, 0>
         look_at  <LA, 4, 0>
         angle 90
}