POV-Ray : Newsgroups : povray.binaries.images : Playing with Photons : Re: Playing with Photons Server Time
8 Sep 2024 02:40:10 EDT (-0400)
  Re: Playing with Photons  
From: Kirk Andrews
Date: 19 Mar 2008 16:30:00
Message: <web.47e18563f97379da5d4a01d0@news.povray.org>
Well, the file is not too long, I'll just post it here:

#version 3.6;

#include "colors.inc"

#declare IsoOk = on;
#declare MediaOk = on;
#declare RadiosityOk = on;
#declare Photons = on;

global_settings {
  assumed_gamma 1.0
  #if (RadiosityOk = on)
    radiosity {
      count 50
      error_bound 1
      recursion_limit 1
      brightness .8
      normal on
    }
  #end
  #if (Photons)          // global photon block
    photons {
      spacing 0.03                 // specify the density of photons
    }

  #end
}

//****************************************************************************************************
//***********************************    LIGHTING
************************************************
//****************************************************************************************************

camera {
  location  <0.0, -0.5, -5.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, -2.0,  0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [1.0 rgb <0.2,0.3,0.8>]
    }
    warp {repeat y flip y}
  }
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1.5, 1.2, .6>*4  // light's color
  translate <0, 20,  10>*1000

  photons {           // photon block for a light source
    refraction on
    reflection on
  }

}


#if (MediaOk = on)
sphere {0,500
  hollow
  pigment {rgbt 1}
  interior {
    media {    // atmospheric media sample
      intervals 4
      scattering { 1, rgb 0.01 }
      samples 1, 10
      confidence 0.9999
      variance 1/1000
      ratio 0.9
      density {
        planar
        //poly_wave 1/4
        scale 10
        translate -5*y
        turbulence .2
      }
    }
  }
  photons {collect off pass_through}
}
#end


//****************************************************************************************************
//***********************************    TEXTURES
************************************************
//****************************************************************************************************


#default {
  texture { pigment {color rgb 1} finish{ambient 0.0} }
}

#declare GrassColor =
pigment {
  cells
  turbulence 2 lambda 5
  scale .3
  pigment_map {
    [0.0 rgb  <0.1, 0.2, 0.0>]
    [0.3 rgb  <0.2, 0.2, 0.0>]
    [0.9 rgb  <0.2, 0.3, 0.0>]
    [1.0 rgbt <0.1, 0.3, 0.0, 1.0>]
  }
}

#declare GrassPig =
  pigment {
    slope y
    pigment_map {
      [ 0.0 rgbt  1]
      [ 0.4 rgbt  1]
      [ 0.8 GrassColor]
      [ 1.0 GrassColor]
    }
  }

#declare LRockPig =
  pigment{
    wrinkles
    turbulence .5
    scale 5
    scale 2*y
    color_map {
      [0 rgb <.7,.5,.4>]
      [1 rgb <.5,.4,.3>]
    }

  }


#declare MountPig =
  pigment {
    cells
    turbulence <1,.1,1>
    scale .24
    pigment_map{
      [0.0 rgb <.6,.3,.2>]
      [1.0 rgb <.5,.2,.1>]
    }
    scale <100,1,100>*3
  }


#declare MountainTex =
texture {
  pigment {MountPig}
  normal {crackle turbulence .5 scale <.2,.05,.2>*2 }
}


//****************************************************************************************************
//***********************************     SCENE
************************************************
//****************************************************************************************************


#declare Cany =
function {
  pigment {
        gradient x
        turbulence <.5,.0,.5>
        //lambda 0
        color_map {
          [0.0 rgb .59 ]
          [0.29 rgb .59 ]
          [0.3 rgb .51 ]
          [0.4 rgb .1 ]
          [0.5 rgb .05 ]
          [0.6 rgb .1 ]
          [0.7 rgb .55 ]
          [0.71 rgb .59 ]
          [1.0 rgb .59 ]
        }
  }
}

#declare G =
function {
  pigment {
    wrinkles
    //turbulence 1
    scale .25*y
    scale 2
  }
}

#declare GG =
function {
  pigment {
    granite
    //turbulence 1
    scale .5*y
    scale .1
  }
}


#if (IsoOk = off)
height_field {
  function
  1000, 1000 {
    Cany(x,y,z*1).red*.5
  }
  //scale 3*z
  translate <-.5,-1,-.5>
  //rotate 180*y
  scale 4
  pigment {rgbt <1,0,0,.5>}
}

#else

#declare Terrain =
isosurface {
  function { y - Cany(x,y*2,z).red*2 }//- G(x,y,z).red*GG(x,y,z).red*.5}
 // function (can also contain declared functions
  //function { fn_X(x, y, z) }        // alternative declared function
  contained_by { box { 0, <1.3,1,6> } }  // container shape
  //threshold 0.0                     // optional threshold value for isosurface
[0.0]
  accuracy 0.0001                      // accuracy of calculation [0.001]
  max_gradient 30                      // maximum gradient the function can have
[1.1]
  //evaluate 5, 1.2, 0.95             // evaluate the maximum gradient
  //max_trace 1                       // maybe increase for use in CSG [1]
  //all_intersections                 // alternative to 'max_trace'
  //open                              // remove visible container surface
  translate <-.5,-1,-.5>
  scale 4
  texture {MountainTex scale .1}

}

#end


Terrain


#declare Obj = Terrain;
#declare Norm = <0, 0, 0>;
//#declare Start = < -880.5, 1000.5,   -800>;
#declare Start = <  -0.3, 1000.5,   -1.8>;
#declare CPos = trace (
                  Obj,             // object to test
                  Start,           // starting point
                  -y,              // direction
                  Norm );          // normal

#declare Start2 = <1, 1000.5,  3>;
#declare CPos2 = trace (
                  Obj,             // object to test
                  Start2,           // starting point
                  -y,              // direction
                  Norm );          // normal


camera {
  location  CPos + <0,.3,0>
  direction 1.25*z
  look_at   CPos2 + <0,-.5,0>
  right     x*image_width/image_height
}





box { <-1,-3,-2>,<1.5,-2.2,3>
  pigment {rgbt 1}
  normal {bumps .1 turbulence .2 scale .03 }
  finish {reflection {.3,.9}}
  interior {
    ior 1.3
    fade_power 1001
    fade_distance 0.7
    fade_color <0.5,0.8,0.6>
  }
  photons {  // photon block for an object
    target 1.0
    refraction on
    reflection on
  }

}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.