POV-Ray : Newsgroups : povray.text.scene-files : Media based clouds Server Time
31 Oct 2024 23:32:01 EDT (-0400)
  Media based clouds (Message 1 to 1 of 1)  
From: Wolfgang Wieser
Subject: Media based clouds
Date: 17 Aug 2004 19:24:48
Message: <412293be@news.povray.org>
As mentioned in p.b.images: 

Note: Units are roughly in meter. 

Wolfgang

---------<snip>---------
// Media clouds test scene: 08/2004 by Wolfgang Wieser. 
// Based on posting to p.b.images by Reactor <rea### [at] hotmailcom>. 
// This file may be used as long as credit is given where it is due. 

#local cloud_density_pattern =
    density {
        //bozo
        wrinkles
        warp {
            turbulence 0.3
            octaves 2   // use small values
        }
        // The ratio "clouds/free air" is determined by the color map 
        // value where we change from color 0 to color 1. 
        color_map {
            [0.00 rgb 0 ]
            [0.55 rgb 0 ]
            [0.65 rgb 1 ]
            [1.00 rgb 1 ]
        }
        scale 0.9*(x+z) + 0.7*y
    };

// Number of media samples taken: 
// Testig: 30; increase for final renderings; <100 (60)
#local media_samples = 30;
// Media MCI variance: 
// Testing: 1e-2; decrease for final renderings: 1e-4
#local media_varience = 1e-2;

// Cloud layer thickness: 
#local cloud_thickness = 2300;
// Planet radius: 
#local planet_radius = 5.9e5;
// Cloud layer radius: 
#local cloud_radius0 = planet_radius+1e3;

#local cloud_object_interior = 
    interior {
        media {
            // For quick testing: absorption and emission trace much faster 
            // than scattering. 
            //absorption 1/300
            //emission 1/600
            
            // Scattering: 
            //  1 -> isotropic
            //  2,3 -> Mie haze/murky (physically relevant here)
            //  4 -> Rayleigh
            // extinction: 1 -> physically correct
            #if(1)
            scattering { 
                /*method*/ 1, 
                rgb 1/700
                //extinction 0.8
            }
            #end
            density {
                gradient y
                // Scale gradient (in all 3 directions) to box height: 
                scale <1,1,1>*cloud_thickness
                density_map {
                    [0.00 rgb 0 ]
                    [0.50 cloud_density_pattern    ]
                    [1.00 rgb 0 ]
                }
            }
            
            // Number of ray intervals from entry to exit point: 
            intervals 1   // 1 = recommended for method 3
            
            // Number of smaples taken per interval. 
            // Must at least be 3 for adaptive method (3). 
            // Method 3 ignores max samples value. 
            samples media_samples,media_samples  // min & max (default: 1,1)
            confidence (1 - media_varience)
            variance media_varience
            
            method 3
            aa_threshold 0.05 // testing 0.1. final: smaller 
            aa_level 1 // testing: 1; final >=3
        }
    };

#local cloud_object_texture = 
    texture {
        // Make box containing the clouds transparent: 
        pigment { rgbt 1 }
        //pigment { checker rgbt 1 rgbt 0.3 scale 100 }
    };

#declare CloudObject = difference {
    sphere { 0, cloud_radius0+cloud_thickness }
    sphere { 0, cloud_radius0 }
    
    texture { cloud_object_texture }
    interior { cloud_object_interior }
    
    hollow
};


// Place sun light: 
light_source
{
    vnormalize(<1,10,8>) * 5 * planet_radius
    color rgb <1,1,1>
    //media_attenuation 1
    translate -planet_radius*y
}

union {
    // Cloud layer: 
    object
    { CloudObject }
    
    // Blue sky sphere: 
    sphere {
        0, 10*planet_radius
        pigment {
            rgb <52,127,255>/255
        }
        finish {
            ambient 1
            diffuse 0
        }
        hollow
    }
    
    // Soil: 
    sphere {
        0, planet_radius
        pigment { checker rgb <0,0.8,0> rgb <0,1,0> scale 300 }
    }
    
    translate -planet_radius*y
}

camera {
    location /*500*/0*y up y look_at 10000*z+2000*y
        translate (planet_radius+500)*y
    //location 15000*y look_at 0 translate 15000*z
    translate -planet_radius*y
}


Post a reply to this message

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