POV-Ray : Newsgroups : povray.binaries.images : Finally, the rings are visible, but... : Re: Finally, the rings are visible, but... Server Time
31 Jul 2024 16:24:20 EDT (-0400)
  Re: Finally, the rings are visible, but...  
From: Reactor
Date: 2 Dec 2009 04:00:01
Message: <web.4b162c53ff0131937dea0d300@news.povray.org>
I noticed that you used ambient values for the finish, and that probe pictures
of Saturn show that the backside of the planet receives quite a bit of light
from the rings.  This made me wonder about using no_image and no_shadow with an
object the same size and shape as the media container object so that its
radiosity can reflect light onto Saturn, then using the no_radiosity flag on the
media container so that it can fit in there as it did before.

Anyway, I went back and took a few liberties with your code... then took a whole
bunch more.  There are a few artifacts on the innermost ring closest to the
shadowed side of Saturn, but those can probably be removed by increasing the
samples.  It is also possible that they are caused by a non-zero specular value
for the finish - note the bright outer edge of the ring on the far right, it
could be the same thing (I didn't check).

Using radiosity gives Saturn a nicely back-lit surface.

//----------- beginning of code

#version 3.6;

// INCLUDES

#include "functions.inc"

// VARIABLES

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

#declare Use_Radiosity = on;

global_settings
{
   max_trace_level 20
   assumed_gamma 1.5

#if(Use_Radiosity)
 radiosity{
  pretrace_start 256/max(image_width,image_height)
  pretrace_end     8/max(image_width,image_height)
  count 100
  nearest_count 10
  error_bound    0.125
  recursion_limit  1
  low_error_factor 0.50
  gray_threshold   0.75
  minimum_reuse 0.00
  brightness  0.50
  adc_bailout 0.01
  normal off
  media  off
  always_sample on
 }
#end

}

// FINISHES

#declare F_Standard_Planetary_Surface =
finish
{
 #if(Use_Radiosity)
   ambient 0 // zero if radiosity is used
  #else
   ambient 0.0001
  #end
   diffuse 1
   brilliance 0.8
}

#declare F_Saturn_Rings =
finish
{
 #if(Use_Radiosity)
   ambient 0 // zero if radiosity is used
  #else
   ambient 0.01
  #end
   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 = 0; // 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 "sat_ring_color_bjoernjonsson.png"
   }
}

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


union
{
sphere // Saturn
{
   0, 1
   texture
   {
     pigment
     {
       image_map
       {
         jpeg "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 radiosity:
{
   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 }

 pigment { rgb 1 }
 finish{ F_Saturn_Rings }
 no_image
 no_shadow
}



//------------ The issue was floating point accuracy - see posts:

// this issue causes artifacts with media when the container shape is too thin.

#local sc2 = 25;

difference // media rings
{
   cylinder
   {
     <0, -0.11, 0>/sc2, <0, 0.1, 0>/sc2, 140390/sc
   }
   cylinder
   {
     <0, -0.12, 0>/sc2, <0, 0.11, 0>/sc2, 74510/sc
   }
     hollow
     no_radiosity
     pigment { rgbt 1 }

     interior
     {
       media
       {

       samples 30
         scattering
         {
           5, 150
           eccentricity -0.4
           extinction    0.4
         }
  emission 2*Use_Radiosity
         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.red,c.green,c.blue>*f.gray ]
          /* you should be multiplying by f.gray, as it returns a transparency
             value from [0..1].
             Note that scattering media is inherently filtering, and the filter
             component of a color needn't be used.
          */
               #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

Note that I changed the path for the image_maps, since I had the files all in a
single directory.


-Reactor


Post a reply to this message


Attachments:
Download 'yagdar_saturn.png' (679 KB)

Preview of image 'yagdar_saturn.png'
yagdar_saturn.png


 

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