POV-Ray : Newsgroups : povray.binaries.images : Finally, the rings are visible, but... : Re: Finally, the rings are visible, but... Server Time
31 Jul 2024 10:26:15 EDT (-0400)
  Re: Finally, the rings are visible, but...  
From: Jörg 'Yadgar' Bleimann
Date: 1 Dec 2009 16:53:49
Message: <4b15906d$1@news.povray.org>
High!

> And, yes, later this evening I will come up with a self-containing 
> Saturn scene to test for you! But first I have to do my daily Afghan 
> bodycount...

Here it is:

// beginning of code

// INCLUDES

#include "functions.inc"

// VARIABLES

#declare sc=13347; // 13347; // 1 POV unit = 13347 kilometres

global_settings
{
   max_trace_level 20
   assumed_gamma 1.5
}

// FINISHES

#declare F_Standard_Planetary_Surface =
finish
{
   ambient 0.0001
   diffuse 1
   brilliance 0.8
}

#declare F_Saturn_Rings =
finish
{
   ambient 0.01
   diffuse 1
   brilliance 0.05
}

#declare bodies = array [2][12]
{
   {           0,     696000,       -1,      -1,	     7.25,     0, 
  0,             0,         0,       0.000009,  63.87,   286.125   }, 
//   0 - Sun
   {  1433449370,      60268,    54364,   60268,  26.73,        2.484, 
  0.055723219, 336.013862,113.642811,-1,       83.537,   40.589    } // 
  1 - Saturn
}


#declare Pos_Saturn = bodies[1][0]*<sin(radians(157.4)), 0, 
cos(radians(157.4))>;

#declare cam = 1; // camera mode

#switch (cam)
   #case (0) // centered on Saturn, view of lit ring ride
     #declare camPos = Pos_Saturn + 350000 * <sin(radians(64)), 0, 
cos(radians(64))>;
     #declare camLook = Pos_Saturn;
     #declare camAng = 40;
   #break
   #case (1) // centered on Saturn, view of unlit ring side
     #declare camPos = Pos_Saturn + 350000 * <sin(radians(244)), 0, 
cos(radians(244))>;
     #declare camLook = Pos_Saturn;
     #declare camAng = 40;
   #break

#end


#macro SetAxis(dec, ras)
   rotate <23.439281-(90-dec), 0, 0>
   rotate <0, 90-ras, 0>
#end

light_source // Sun
{
   0
   color rgb 1
   looks_like
   {
     sphere
     {
       0, 1
       texture
       {
        pigment { color rgb <1, 1, 0.85> }
        finish { ambient 1 diffuse 0 }
       }
       scale bodies[0][1]/sc
       SetAxis(bodies[0][10], bodies[0][11])
     }
   }
}

#declare Saturn_Rings_Colors =
pigment
{
   image_map
   {
     png "solarsys/sat_ring_color_bjoernjonsson.png"
   }
}

#declare Saturn_Rings_Transparency =
pigment
{
   image_map
   {
     png "solarsys/transparency_bjoernjonsson.png"
   }
}


union
{
sphere // Saturn
{
   0, 1
   texture
   {
     pigment
     {
       image_map
       {
         jpeg "solarsys/saturn_bjoernjonsson.jpg"
         map_type 1
         interpolate 2
       }
     }
     finish { F_Standard_Planetary_Surface }
   }
   scale <bodies[1][1], bodies[1][2], bodies[1][3]>/sc
}


difference // rings
{
   cylinder
   {
     <0, -0.11, 0>/sc, <0, 0.1, 0>/sc, 140390/sc
   }
   cylinder
   {
     <0, -0.12, 0>/sc, <0, 0.11, 0>/sc, 74510/sc
   }
     hollow
     pigment { rgbt 1 }
     interior
     {
       media
       {
         scattering
         {
           5, 10
           eccentricity -0.4
           extinction 0
         }
         // absorption 0.
         density
         {
           cylindrical
           density_map // preliminary low-res version
           {
             #declare a=0;
             #while (a<255)
               #declare c=eval_pigment(Saturn_Rings_Colors, 
<509/510-a/255, 0.5, 0>);
               #declare f=eval_pigment(Saturn_Rings_Transparency, 
<509/510-a/255, 0.5, 0>);
               [a*(((140390-74510)/140390)/255) rgb c*3000 /* filter 
f.gray */ ]
               #declare a=a+1;
              #end
            }
            scale 140390/sc
         }
       }
     }
   }
   SetAxis(bodies[1][10], bodies[1][11])
   translate Pos_Saturn/sc
}

camera
{
   location camPos/sc
   look_at camLook/sc
   angle camAng
}

// end of code

See you in Khyberspace!

Yadgar


Post a reply to this message

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