POV-Ray : Newsgroups : povray.binaries.images : Rings cutting atmosphere phenomenon : Rings cutting atmosphere phenomenon Server Time
7 Aug 2024 05:18:47 EDT (-0400)
  Rings cutting atmosphere phenomenon  
From: EagleSun
Date: 27 May 2006 23:40:00
Message: <web.44791b1274beee03bb1697f60@news.povray.org>
I'm working on the planets in an up-coming Star Wars movie, and I've ran
into a peculiar phenomenon, trying to

render rings around a planet produces an artifact where the rings cut away
the atmosphere of the planet.  For the

model, I use Saturn.

Here is the source code that reproduces the phenomenon...

// Saturn
#macro Saturn(_distance, _hour, _year, _heading, _pitch, _bank)
 SunLight(saturn_distance, sun_radius, rgb 1, 10, _heading, _pitch, _bank)
 #local _albedo=0.46;
 #local _radius=60268;
 #local _tilt=26.7;
 #local _tiltshift=0;
 #local _ringalbedo=0.66;
 object {
  LandSurface(_radius, 200, 0, 1, jpeg_type, "Solar
System/Saturn/saturn.jpg", png_type, "Solar

System/Saturn/saturn-cloud-bump.png")
  TransformWorld(_distance, _hour, _year, _heading, _pitch, _bank, _tilt, 0)
 }
 object {
  Atmosphere(_radius, 60, 91/255, 117/255, 192/255, 1/8000, 3, 0)
  TransformWorld(_distance, _hour, _year, _heading, _pitch, _bank, _tilt, 0)
 }

 PlanetRings("Solar System/Saturn/saturn_13182_rings.inc", 140460, 74500, 2,
78, _ringalbedo, _distance,

_hour, _year, _heading, _pitch, _bank, _tilt, _tiltshift)
#end




#macro LandRSurface(_radius, _hirelief, _lorelief, _albedo,
_landmapimagetype, _landmap, _landbumpimagetype,

_landbump)
 #local _planetradius=_radius*unitscale;
 #local _planethirelief=_hirelief*unitscale;
 #local _planetlorelief=_lorelief*unitscale;
 #local _planetdelta=_planethirelief-_planetlorelief;
 #local fn_PlanetBump=function{
  pigment{
   image_map{
    map_image(_landbumpimagetype, _landbump)
    map_type 1
    //once
    interpolate 2
   }
  }
 }
 isosurface
 {
  function {
   f_sphere(x, y, z, (_planetradius+_planetlorelief))-((1-fn_PlanetBump(x,
y, z).red)

*_planetdelta)
  }
  contained_by {
   sphere{
    0,(_planetradius+_planethirelief)
   }
  }
  accuracy surface_accuracy*unitscale
  texture
  {
   pigment
   {
    image_map
    {
     map_image(_landmapimagetype, _landmap)
     map_type 1
    }
   }
   finish
   {
    ambient 0
    brilliance land_brilliance
    albedo(_albedo)
   }
  }
 }
#end



#declare Atmosphere_Option=5;
#macro Atmosphere(_land_radius, _hh_value, _r, _g, _b, _atm_mag,
_decay_magnitude, _fade_distance)
 #switch (Atmosphere_Option)
 #case (1)
  #local _atm_height=4;
  #local _atm_lo=pow(16, _hh_gamma);
  #break
 #case (2)
  #local _atm_height=10;
  #local _atm_lo=pow(1024, _hh_gamma);
  #break
 #case (3)
  #local _atm_height=12;
  #local _atm_lo=pow(4096, _hh_gamma);
  #break
 #case (4)
  #local _atm_height=16;
  #local _atm_lo=pow(65536, _hh_gamma);
  #break
 #case (5)
  #local _atm_height=32;
  #local _atm_lo=pow(65536*65536, _hh_gamma);
  #break
 #end
// #local _half_height=_hh_value/2;
// #local _half_height=_hh_value*_hh_gamma;
 #local _half_height=_hh_value;
 #local _atm_magnitude=_atm_mag;

// #local _atm_altitude=_atm_height*_half_height*_hh_antigamma;
 #local _atm_altitude=_atm_height*_half_height;

 #local _atm_radius=_land_radius+_atm_altitude;
 #local _color=rgb<_r, _g, _b>;
 #local _color_map=_color;

 #local _atm_hi_color=_color_map*_atm_height;
// #local _atm_lo_color=_color_map/_atm_lo;
 #local _atm_lo_color=_color_map*0;

// difference {
  sphere {
   <0, 0, 0>, _atm_radius*unitscale
  }
//  sphere {
//   <0, 0, 0>, (_land_radius-_atm_altitude)*unitscale
//  }
  hollow on
  //no_shadow
  material {
   texture {
    pigment {
     rgbt 1
    }
    finish
    {
     ambient 0
     brilliance atmos_brilliance
     diffuse 0
    }
   }
   interior {
    ior 1
    #if (_fade_distance != 0)
     fade_distance _half_height*unitscale*_fade_distance
     fade_power _decay_magnitude
     fade_color <_r, _g, _b>
    #end
    media { // Info from POV-Ray manual: Density*sqrt(3)/vlength(Scale)
     method 3
    // absorption _color*(_atm_magnitude/unitscale)*_decay_magnitude
     scattering {
      4, _color*(_atm_magnitude/unitscale)
     // eccentricity 0.125 // available only on scattering type 5.
      extinction _decay_magnitude
     }
     density {

      function { HalfHeight(_land_radius, _atm_altitude, _half_height,

_atm_height) }
      density_map {
       [0 _atm_lo_color]
       [1 _atm_hi_color]
      }

      scale (_atm_radius*unitscale)
     }
    }
   }
  }
// }
#end



#macro PlanetRings(_ringimage, _outer, _inner, _nscale, _divisions,
_ringalbedo, _distance, _hour, _year, _heading,

_pitch, _bank, _tilt, _tiltshift)
 #include _ringimage
 #local ABdiff=_outer-_inner;
 #local Xring=_outer/_nscale;
 #local Malpha=_nscale*_inner/_outer;
 #local Step=ABdiff*_nscale/(_divisions*_outer);
 #local i=1;
 #while (i<=_divisions)
  object {
   disc
   {
    <0, 0, 0> y, Malpha+(i)*Step, Malpha+(i-1)*Step
    pigment
    {
     onion
     colour_map
     {
      Planet_RingMap(i)
     }
    }
    finish
    {
     ambient 0
     brilliance 1
     albedo(_ringalbedo)
    }
    scale Xring*unitscale
   }
   double_illuminate
   TransformWorld(_distance, _hour, _year, _heading, _pitch, _bank, _tilt,
_tiltshift)
  }
  #local i=i+1;
 #end
#end


Post a reply to this message


Attachments:
Download 'sat-cas1.png' (441 KB)

Preview of image 'sat-cas1.png'
sat-cas1.png


 

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