// PoVRay 3.7 Scene File " ... .pov"
// author:  ...
// date:    ...
//--------------------------------------------------------------------------

// +w640 +h540 +am3 +a0.1 +ac0.9 +r3 +wt6
// +w640 +h540 +am3 +a0.01 +ac0.9 +r4 +wt6

//#version 3.7;
#version unofficial patch 3.7;
#patch "upov-radiosity-no_cache" 0.1;
#patch "upov-reflection-roughness" 0.9;

global_settings {
  assumed_gamma 1.0 
  radiosity {
    no_cache
    brilliance on
    pretrace_start 0.08           // start pretrace at this size
    pretrace_end   0.004          // end pretrace at this size
    count 100, 1000000                // higher -> higher quality (1..1600) [35]
    nearest_count 10, 5           // higher -> higher quality (1..10) [5]
    error_bound 1                 // higher -> smoother, less accurate [1.8]
    recursion_limit 1             // how much interreflections are calculated (1..5+) [2]
    low_error_factor .3           // reduce error_bound during last pretrace step
    gray_threshold 0.0            // increase for weakening colors (0..1) [0]
    minimum_reuse 0.015           // reuse of old radiosity samples [0.015]
    maximum_reuse 0.1							// new parameter 3.7 [0.2]
    brightness 1                  // brightness of radiosity effects (0..1) [1]

    adc_bailout 0.01/2
    normal on                   // take surface normals into account [off]
    media on                    // take media into account [off]
    always_sample off           // turn sampling in final trace off [on]
    //max_sample 1.0              // maximum brightness of samples
  }
}

#default {finish{ ambient 0.0 diffuse 0.9 }} 
//--------------------------------------------------------------------------
#include "colors.inc"
#include "textures.inc"
#include "glass.inc"
#include "metals.inc"
#include "golds.inc"
#include "stones.inc"
#include "woods.inc"
#include "shapes.inc"
#include "shapes2.inc"
#include "functions.inc"
#include "math.inc"
#include "transforms.inc"
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
#declare Camera_Number = 0 ;
//---------------------------------------------------------------------------------
// camera -------------------------------------------------------------------------
#switch ( Camera_Number )
#case (0)
  #declare Camera_Location = < 0.00, 2.00, -3.00> ;  // front view
  #declare Camera_Look_At  = < 0.00, 1.00,  0.00> ;
  #declare Camera_Angle    =  75 ;
#break
#case (1)
  #declare Camera_Location =  < 2.0 , 2.5 ,-3.0> ;  // diagonal view
  #declare Camera_Look_At  =  < 0.0 , 1.0 , 0.0> ;
  #declare Camera_Angle    =  90 ;
#break
#case (2)
  #declare Camera_Location = < 3.0, 1.0 , 0.0> ;  // right side view
  #declare Camera_Look_At  = < 0.0, 1.0,  0.0> ;
  #declare Camera_Angle    =  90 ;
#break
#case (3)
  #declare Camera_Location = < 0.00, 5.00,  0+0.000> ;  // top view
  #declare Camera_Look_At  = < 0.00, 0.00,  0+0.001> ;
  #declare Camera_Angle    = 90 ;
#break
#else
  #declare Camera_Location = < 0.00, 1.00, -3.50> ;  // front view
  #declare Camera_Look_At  = < 0.00, 1.00,  0.00> ;
  #declare Camera_Angle    =  75 ;
#break
#break
#end // of "#switch ( Camera_Number )"  
//--------------------------------------------------------------------------
camera{ // ultra_wide_angle // orthographic 
        location Camera_Location
        right    x*image_width/image_height
        angle    Camera_Angle
        look_at  Camera_Look_At
      }

// sun ---------------------------------------------------------------------
#declare SunPosition = <-3000, 3000, -3000>;
#declare SunDis      = vlength(SunPosition)*2/215;

light_source {
    SunPosition
    color rgb <1, 1, 1>*2
    area_light
    SunDis*x, SunDis*z, // lights spread out across this distance (x * z)
    5, 5                // total number of lights in grid (4x*4z = 16 lights)
    adaptive 2          // 0,1,2,3...
    jitter              // adds random softening of light
    circular            // make the shape of the light circular
    orient              // orient light
    parallel
    point_at <0, 0, 0>
    looks_like {
      sphere {
        0, SunDis
        pigment {color rgb <1,1,1>*2}
        finish {
          emission 100
        }
      }
    }
}

#local Lamp =
sphere {
  <0,0,0>, 1
  texture {
    pigment {srgb 1}
    finish {
      diffuse albedo 1
      emission 1
      //fresnel on
    }
  }
}
/*
object {Lamp
  scale 0.3
  translate <-4, 2, 5>
}
*/

// sky ---------------------------------------------------------------------
sphere {
  0, 1
  hollow
  pigment { 
    gradient <0, 1, 0>
    color_map { 
      [0.00 srgb <0.6,0.7,1.0>*1.5]
      [0.35 srgb <0.1,0.0,0.8>*1.5]
      [0.65 srgb <0.1,0.0,0.8>*1.5]
      [1.00 srgb <0.6,0.7,1.0>*1.5] 
    } 
    scale 2         
  }
  finish {
    emission 1
    diffuse albedo 0
    brilliance 1, 1
  }
  scale 10e5
}

// ground -------------------------------------------------------------------------
plane { <0, 1, 0>, 0 
  texture { 
    pigment {
      checker color srgb <0.99, 0.99, 0.99> color srgb <0.25, 0.15, 0.1>
    }
    //normal { bumps 0.75 scale 0.025}
    finish { 
      diffuse albedo 0.8
      brilliance 1, 1
      reflection {
        0.0, 0.01
      }
      fresnel on
    }
  }
  interior { ior 1.5 }
}

//---------------------------------------------------------------------------------
//---------------------------- objects in scene -----------------------------------
//---------------------------------------------------------------------------------
// sample sphere
sphere { 
  <0,0,0>, 1.00 
  texture {
    pigment {srgb <0.8, 0.7, 0.7>*0.5 }
    finish {
      diffuse albedo 0.8
      brilliance 3, 3
      reflection {
        0.0, 1.0 
        //roughness 0.001
        //fresnel on
        //metallic on
      }
      fresnel on
      metallic on
    }
  }
  interior { ior 1.5 }

  scale <1,1,1>  rotate <0,0,0>  translate <0,1.35,0>  
}