POV-Ray : Newsgroups : povray.text.scene-files : Mountains with snow preferential to shadows [revisited] Server Time: 19 Dec 2018 13:37:40 GMT
  Mountains with snow preferential to shadows [revisited] (Message 1 to 1 of 1)  
From: Thomas de Groot
Subject: Mountains with snow preferential to shadows [revisited]
Date: 6 Feb 2014 13:19:26
Message: <52f38bde$1@news.povray.org>
GDS|Entropy's mention of Bob Hughes in p.b.i., reminded me of a scene 
from 2002/2003 which I had difficulty to make work correctly. I 
revisited and made some necessary changes, especially making the extra 
snow dependent on the sunlight, using sunpos.inc. There main remain 
potential problems, especially with the different scaling vectors used 
in the textures. However, this scene work as expected.

Beware of comments broken over several lines!


/* Justin Smith's modified pov script to try and make it seem snow is in
shadowed places. I've only rewritten this as an example which hopefully does
exactly what was intended. However, no guarantee!
                                                                Bob 
Hughes */

// Persistence of Vision Ray Tracer Scene Description File
// File: mountains with snow preferential to shadows.pov
// Vers: 3.5
// Desc: mountains and snow, with more snow in shadows
// Date: 2003.833
// Auth: Justin Smith, and Bob Hughes
// adapted to sunpos and version 3.7 by Thomas de Groot (February 2014)


// Render settings (right-click on a line below):
// +w800 +h600 +a0.3 +am2 +bm2 +wt6
// +w1600 +h1200 +a0.3 +am2 +bm2 +wt6

#version 3.7;

#include "colors.inc"
#include "functions.inc"
#include "sunpos.inc"
#include "transforms.inc"

#declare Rad = on;

// See Cousin Ricky's documentation
#include "Cousin Ricky\Radiosity-pretrace\radiosity-pretrace.inc"
#declare Radiosity_Pretrace_debug = true;

global_settings {
   assumed_gamma 1.0
   #if (Rad)
   radiosity {
     //pretrace_start 0.08
     //pretrace_end   0.004
     Radiosity_Pretrace (0.1, 0.004)
     count 50, 500
     nearest_count 10, 5
     error_bound 0.6
     recursion_limit 2
     low_error_factor .3
     gray_threshold 0.0
     minimum_reuse 0.010
     maximum_reuse 0.1	
     brightness 1

     adc_bailout 0.01/2
     normal off
     media off
     always_sample off
     //max_sample 1.0
   }
   #end
}

// perspective camera
camera {
   location  <0.0, 2.0, -5.0>*1000
   look_at   <0.0, 0.0,  0.0>
   right     x*image_width/image_height
   //rotate -45*y // 90 degree azimuth difference from light source
}

#declare Kelvin         = 6200; // Sun's temperature: 2800=red; 
7500=blue white.
#declare SunFactor      = 2;
//NOTE: LONG/LAT conversion: 
http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html
#declare SunPosition    = SunPos(2012, 12, 5, 16, 0, 25, 31.7625, 
25.0888);  //year, month, day, hour(gmt), minute, +-degrees, lat, long
//note: Azimuth (Az) and Altitude (Al) are automatically declared.
#debug concat("\nSun azimuth: ",str(Az,5,3),"; Sun altitude: 
",str(Al,5,3),"\n\n")

#include "CIE.inc"
#macro SunLight (Kelvin,SunFactor)
   Blackbody(Kelvin)*SunFactor
#end

light_source {
   SunPosition
   color SunLight (Kelvin,SunFactor)  // light's color
   parallel
   point_at <0, 0, 0>
}

sky_sphere {
   pigment {
     gradient y
     color_map {
       [0.0 rgb <0.6,0.7,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

plane {
   y, -1
   pigment { color srgb <0.7,0.5,0.3> }
}

#declare fnpigment1 =function {
pigment
{
agate
color_map {
  [0 rgb 0]
  [1 rgb 1]
} scale 5000
}
}

#declare fnpigment2 =function {
pigment
{
granite
color_map {
  [0 rgb 0]
  [1 rgb 1]
} scale 5000
}
}

#declare fnpigment3 =function {
pigment
{
bumps
color_map {
  [0 rgb 0]
  [1 rgb 1]
} scale 5000
}
}

#declare pigment1 =
pigment
{
   slope
   {
     y, 0, 1 // range of color map
   }
   color_map
   {
     [0.0 color rgbt <0,0,0,1>]
     [0.3 color rgbf <1,1,1,0.9>]
     [1.0 color rgbf <1,1,1,0>]
   }
}

#declare pigment2 =
pigment
{
   slope
   {
     y, 0, 1 // range of color map
   }
   color_map
   {
     [0.0 color rgbt <0,0,0,1>]
     [0.6 color rgbf <1,1,1,0.6>]
     [1.0 color rgbf <1,1,1,0>]
   }
}

#declare pigment3 =
pigment {
   slope {
     SunPosition, // align with sunlight
     0, 1 // range of color map
   }
   color_map {
     [0.3 color rgbf <1, 1, 1, 0.0>] //---->away from sunlight
     [0.5 color rgbf <1, 1, 1, 0.3>]
     [0.7 color rgbf <1, 1, 1, 0.9>]
     [0.9 color rgbf <1, 1, 1, 1.0>] //---->towards sunlight
   }
}

#declare Mountains =
isosurface {
   function {
     (y
       - fnpigment2(x,y,z).gray*100)
       - (fnpigment1(x,y,z).gray
       + fnpigment1(x,y,z).gray*10
       + fnpigment2(x,y,z).gray*10
       + fnpigment3(x,y,z).gray*.05)
   }
   contained_by {
     box {<-5000,0,-5000>,<5000,125,5000>}
   }
   max_gradient 1
   texture {
     pigment {rgb <0.4, 0.2, 0>}
     finish {diffuse 0.5}
   }
   texture {
     pigment {
       gradient y
       //turbulence <0,.1,0>
       pigment_map {
         [.5 color rgbf <1,1,1,1>]
         [.6 pigment1]
         [.8 pigment2]
         [1 color rgbf <1,1,1,0>]
       }
       scale 125
     }
     finish {
       diffuse 0.8
     }
   }
   texture {
     pigment {
       gradient y
       //turbulence <0,.1,0>
       pigment_map {
         [0.2 color rgbf <1,1,1,1>]
         [0.4 pigment3]
         [0.5 pigment3]
         [0.6 color rgbf <1,1,1,1>]
       }
       scale <333,125,333>
     }
     finish {
       diffuse 0.8
     }
   }
   scale <1,4,1>
}

object {Mountains}


Post a reply to this message

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