// povray +A0.01 +R4 +AM2 +Q9 +W1024 +H768 +Ohex.png     hex.pov
// povray +A0.01 +R4 +AM2 +Q9 +W1024 +H768 +Oxeh.png +K1 hex.pov

#declare T =
texture {
    pigment {
        function { (floor((floor(y-x*sqrt(3))-1)/2) + floor((floor(y+x*sqrt(3))-1)/2))/10 }
        color_map { [0 rgb .1] [.5 rgb 1] [1 rgb .1] }
    }
}

#declare T1 =
texture {
    pigment {
        hexagon rgbf <1,.5,0,1>, rgbf <.2,.7,.9,1>, rgbf <0,1,.5,1>
        rotate -90*x
        scale 1/sqrt(3)
    }
}

#declare T2 =
    texture {
        pigment {
            hexagon rgbf <0,.5,1,1>, rgbf <.8,.3,.1,1>, rgbf <1,0,.5,1>
            rotate -90*x
            scale 1/sqrt(3)
        }
    }

plane {
    -z, 0
    texture { T }
    #if (clock > 0)
        texture { T2 }
    #else
        texture { T1 }
    #end
    finish { ambient 1 }
}

plane {
    z, 0
    texture { T }
    #if (clock > 0)
        texture { T1 }
    #else
        texture { T2 }
    #end
    scale sqrt(2)
    translate -z*15
    rotate z*90
    finish { ambient 1 }
}

#declare S =
sphere {
    -z, 1
    scale 3
    pigment { rgb 0 }
    finish { reflection 1 }
}

object {
    S
    scale 1.55
    translate <0,-7.5,0>
}

camera {
    location <-5,-15,-8>
    look_at 0
    up 10*y
    right 10*x*image_width/image_height
    angle 100
}

global_settings {
    ambient_light 9
}

