// Persistence of Vision Ray Tracer Scene Description File // File: Suntest.pov // Vers: MegaPOV 0.3 // Desc: An excercise in creating a realistic sun disc. // Date: January 21, 2000 // Auth: Abe Madey (bullfrog@taconic.net) // // Comments: The way this scene is set up with the sun rising (a disc partially "submerged" in a plane) // is not really ideal although it works more or less for this excercise. There are also many more // variables that would be worth including (eg. defining a separate horizon color instead of linking it // to the sun color). // // Camera Positioning: there are different ways of going about this. For "scenery" shots I // prefer to rotate the camera vertically (pitch) and horizontally (yaw) as opposed to // defining a look_at point. Depending on which method you use, the positioning of the // flare disc in front of the camera differs also. #declare Cam_pos = y*1; #declare Cam_dir = z; //Initial camera direction #declare Cam_yaw = 0; #declare Cam_pitch = 0; // Basic Scene Controls: these may be turned on or off in any combination. Try it. #declare Sundisc = true; #declare Sunflare = true; #declare Clouds = false; //will significantly slow down the render (uses media) // Some fine tuning controls. Other aspects you'll have to change directly. The affect the // flare, disk and light source. Try different colors on the sun and sky. #declare Flare_size = 5 //muliple of sun diameters #declare Sun_size = 20; //pov units #declare Sun_dist = 100; //ditto #declare Sun_az = -10; //azimuth (+z is zero) #declare Sun_alt = 3; //sun altitude #declare Sun_color = rgb <0.99609, 0.99609, 0.78125>//rgb <0.99609, 0.79297, 0.27344>; #declare Sun_brightness = 1.3; #declare Sky_color = rgb <0.65625, 0.64063, 0.71875>; // Light sources. Two (nearly) identical light sources are used: one to illuminate the scattering media, // and the other for everything else. I found this gave me better control over the contrast of the clouds // as opposed to working only with density. light_source { z*Sun_dist Sun_color*Sun_brightness rotate -x*Sun_alt rotate y*Sun_az groups "scene" } light_source { z*Sun_dist Sun_color*Sun_brightness*2 rotate -x*Sun_alt rotate y*Sun_az groups "clouds" } // Sun Disc: a disc place at the light source with the normal facing the camera. Uses spherical pattern // to provide a fuzzy edge (this can be fiddled with). #if (Sundisc) disc{ //Sun 0, z, Sun_size no_shadow hollow pigment {spherical color_map{[0 rgbt 1][.2 Sun_color*Sun_brightness]} scale Sun_size/2 } finish {ambient 1} // this bit lines it up with the light source translate z*Sun_dist rotate -x*Sun_alt rotate y*Sun_az light_group "scene" } #end // Flare: faster and better control doing it this way rather than relying on scattering media. // does have some drawbacks, though not really in this application #if (Sunflare) disc{ 0, Cam_dir, 1 no_shadow hollow //yes, this needs to be hollow if fog and media are to be seen through it! pigment {spherical color_map{[0 rgbf 1][1 Sun_color*Sun_brightness filter .3]} cubic_wave} finish{ambient 1} scale .001*Flare_size // this next bit lines up the flare with the camera and light source (.01 units in front of the camera). translate vnormalize(Cam_dir)*.01 rotate -x*Sun_alt rotate y*Sun_az translate Cam_pos light_group "scene" } #end // Sky colors are defined here. A simple gradient from the horizon to the zenith. Might consider using // a poly_wave modifier here for the pigment. The black hole warp is there to help "push" the horizon // glow up around the sun (note the vector fuctions for the alignment). This is probably not appropriate // for higher sun altitudes and should be commented out in that case. Try commenting it out any way and // evaluate the difference it makes. sky_sphere{ pigment{ gradient y color_map{[.5 Sun_color*.9][.7 Sky_color]} scale 2 translate -y*1 warp{black_hole vaxis_rotate(vaxis_rotate(z,-x,Sun_alt),y,Sun_az), 1 inverse strength 1.5} } } // Clouds. Media clouds is a subject for itself and this is really just icing on the cake for this // excercise. The following media has not really been worked through and there are alot of improvements // and fine tuning necessary. Feel free to fiddle! #if (Clouds) box{ //cloud plane container <-20, 2, -200>,<200, 2.2, 200> hollow no_reflection pigment {rgbf 1} interior{ media { scattering {1, color rgb <1, .9, .8>*1 extinction 1} density { bozo color_map{[.65 color rgb 0][.67 color rgb 1]} scale 5 // the next line makes the clouds "patchy" #declare w_scale = 10 scale 1/w_scale warp{turbulence .1 lambda 2 omega 1.3} scale w_scale } method 3 samples 1,5 intervals 4 light_group "clouds" } } } #end // Horizon Haze. To soften the horizon. Could be tuned a little better. fog{fog_type 2 fog_alt 3 distance 100 color Sun_color} // Water. A hack job at an ocean surface. plane { y, 0 pigment {color rgb <0.5625, 0.59375, 0.625>} normal {bumps bump_size .2 scale <.3,.2,.05> } finish {reflection .6} light_group "scene" } // And finally the camera. camera { location 0 direction Cam_dir rotate -x*Cam_pitch rotate y*Cam_yaw translate Cam_pos angle 80 }