POV-Ray : Newsgroups : povray.text.scene-files : Hazy Days ... source. Server Time
1 Nov 2024 03:14:47 EDT (-0400)
  Hazy Days ... source. (Message 1 to 1 of 1)  
From: Michael C  Andrews
Subject: Hazy Days ... source.
Date: 17 Jul 1998 14:02:25
Message: <35AF83B2.500C@reading.ac.uk>
/*
OK - here's the source to my 'Hazy Days ...' picture - my first attempt
to use media for atmospheric effects.

	Enjoy!
		Mike Andrews.
*/

#include "colors.inc"

global_settings { assumed_gamma 1.0 }

background { color red 0.1 green 0.3 blue 0.8 }

#declare camLookAt = <0, 100, 0>;
#declare camLoc    = <10, 2, -250>;
#declare lightDist = 10000;
#declare lightRad  = sin(radians(0.5))*lightDist;
#declare lightPos  = vnormalize(camLookAt*3 - camLoc) * lightDist;

camera {
	location  camLoc
	direction <0, 0, 1.0>
	look_at   camLookAt
}

// set up light source somewhere to right-top of image
light_source {
	0*x color White
	media_attenuation on
	looks_like {
		sphere { 0, lightRad
			pigment { White }
			finish { ambient 1 diffuse 0 }
		}
	}
	translate lightPos
	rotate 50*y
}

// ground sphere
sphere { 0, 1 scale 15000 translate -15000*y
	pigment { colour Wheat }
}

// container for atmosphere - keeps it only below the clouds
sphere { 0, 1
	pigment { rgbf 1
	}
	finish { ambient 0 diffuse 0 }
	interior {
		media {
			intervals 10
			scattering { 
				4, rgb <0.004, 0.005, 0.007> 
				extinction 1.0
			}
			samples 1, 10
			confidence 0.9999
			variance 1/1000
		}
	}
	hollow
	scale 15099.99
	translate -15000*y
}

// density variation at centre of clouds
#declare D_Cloud_Center = density {
	spotted triangle_wave
	colour_map {
		[0.0 colour Gray75]
		[1.0 colour Gray25]
	}
}

// density variation at edges of clouds
#declare D_Cloud_Edge = density {
	spotted triangle_wave
	colour_map {
		[0.0 colour Gray50]
		[1.0 colour Gray05]
	}
}

// container for clouds
difference {
	sphere { 0, 1 scale 15115 hollow }
	sphere { 0, 1 scale 15100 hollow }
	pigment { colour rgbf 1.0 }
	finish { ambient 0 diffuse 0 }
	interior {
		media {
			intervals 10
			scattering { 2, rgb 1.0 }
			samples 1, 10
			confidence 0.9999
			variance 1/1000
// set density for flat bases, taller tops
			density {
				onion
				#declare cloudDepth = 15 / 15100;
				colour_map {
					[0                colour Black]
					[0.2 * cloudDepth colour White]
					[cloudDepth       colour Black]
				}
				scale 15100
			}
// define the basic cloud shapes
			density {
				spotted triangle_wave
				colour_map {
			    		[0.3 colour White]
					[0.7 colour Gray05]
				}
				scale 2.5 * 15
			}
// define large 'cells' in the clouds
			density {
				spotted triangle_wave
				density_map {
					[0.0 D_Cloud_Center scale 0.2]
					[0.5 D_Cloud_Edge scale 0.2]
				}
				scale 2.5 * 15
			}
// define small scale variation
			density {
				spotted triangle_wave
				density_map {
					[0.0 D_Cloud_Edge scale 0.08]
					[0.5 D_Cloud_Edge scale 0.08]
				}
				scale 2.5 * 15
			}
		}
	}
	translate -15000*y
	hollow
}


Post a reply to this message

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