1 // This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
2 // To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a
3 // letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
5 // Persistence of Vision Raytracer Scene Description File
8 // Description: This file demonstrates the use of scattering media
9 // to create a sky with clouds. It attempts to simulate an actual
10 // atmosphere: there is an outer shell of media that scatters blue
11 // light, and an inner cloud shell that scatters white. The scattered
12 // light from the outer shell makes the sky appear blue, and the light
13 // that passes through is tinted orange by its passage, giving the
14 // clouds an orange color.
16 // Updated: 2013/02/15 for 3.7
20 // use 16:9 aspect ratio
22 //*******************************************
33 #
declare CamPos
= <-5, 1,-25>;
38 right x*image_width
/image_height
// keep proportions with any aspect ratio
43 light_source {CamPos
, color Gray30 media_interaction
off}
44 //light_source {vrotate(z, <-1, 8, 0>)*500000, color rgb < 1, 0.8, 0.65>}
46 #
declare SunPos
= vrotate(z, <-12, 8, 0>)*1000000;
47 light_source {SunPos
, color White
*2}
51 finish {ambient 10 diffuse 0}
57 #
declare PlanetSize
= 50000;
62 translate -y*PlanetSize
65 // pigment {color rgb < 1, 1, 1>}
66 pigment {color rgbf < 1, 1, 1, 1>}
70 fresnel
//use the fresnel form of angle-dependant reflection
71 metallic//use metallic reflection
74 metallic//use metallic highlights
76 normal {bumps bump_size 0.075 scale < 4, 1, 1>*0.025}
79 ior 1.33//required for fresnel reflection
83 absorption
color rgb < 0.75, 0.5, 0.25>*0.005
89 scale PlanetSize
- 100
90 translate -y*PlanetSize
96 #macro SkyShell
(minAlt
, maxAlt
, Int
)
98 sphere {< 0, 0, 0>, 1 scale (PlanetSize
+ maxAlt
)}
99 sphere {< 0, 0, 0>, 1 scale (PlanetSize
+ minAlt
)}
101 texture {pigment {color rgbf 1}}
102 translate -y*PlanetSize
107 //A much more realistic sky could be done using multiple layers
108 //of clouds to simulate clouds of different densities and with
109 //different altitudes. Of course, this would render a lot slower...
111 //the "cloud shell", creates clouds.
115 method
3 aa_threshold 0.1 aa_level 3
116 samples 4 intervals
1
117 scattering {2, color White
*0.0075 extinction
1}
124 [0.55 color rgb 0.035]
131 samples 2 intervals 1
132 scattering {2, color White*0.0075*0.015 extinction 1}
137 //the "atmosphere shell", creates the blue sky and orange light.
142 samples 2 intervals
1
143 scattering {4, color rgb < 0.25, 0.6, 0.9>*0.00075 extinction
1}