POV-Ray : Newsgroups : povray.binaries.images : Probably I'm just in fact too stupid... Server Time
31 Jul 2024 16:32:13 EDT (-0400)
  Probably I'm just in fact too stupid... (Message 21 to 22 of 22)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Jörg 'Yadgar' Bleimann
Subject: Re: Probably I'm just in fact too stupid...
Date: 27 Nov 2009 08:50:25
Message: <4b0fd921@news.povray.org>
High!



> The code? Too long and complicated to be posted here, I fear...

(9 hours of sleep later)

O.k., I'll try it:

[...]
#include "starry_sky.inc" // self-programmed macro to generate a starry 
sky sphere according to real astronomical data, 900 stars, configurable 
according to camera angle and image resolution
#include "functions.inc" // for eval_pigment()

[...]

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

[...]

#declare rs=0; // radiosity flag, 0 = radiosity off
#declare lores=0; // flag for low resolution Saturnian rings (dependent 
on camera distance in the future)

[...]

#declare F_Standard_Planetary_Surface =
finish
{
   #if (!rs)
     ambient 0.0001
   #end
   diffuse 1
   brilliance 0.8
}

#declare F_Saturn_Rings =
finish
{
   #if (!rs)
     ambient 0.01
   #end
   diffuse 1
   brilliance 0.05
}

#declare F_Saturn_Rings_UnlitSide =
finish
{
   #if (!rs)
     ambient 0.3
   #end
   diffuse 5
   brilliance 0.05
}


#declare cam = 7; // camera mode

// CELESTIAL BODIES OF THE SOLAR SYSTEM DATA
// Column 0: orbital semi-major axis (to the Sun or the respective 
planet) in kilometres
// Column 1: radius in x dimension, in kilometres
// Column 2: radius in y dimension, in kilometres (if oblateness is 
given then stated as -1)
// Column 3: radius in z dimension, in kilometres (if oblateness is 
given then stated as -1)
// Column 4: axial tilt in degrees (planets: relative to orbit around 
the Sun, moons: relative to planet's equatorial plane)
// Column 5: orbital inclination in degrees (planets: relative to 
ecliptic, moons: relative to planet's equatorial plane)
// Column 6: orbital eccentricity
// Column 7: perihelion argument (degrees; if variable (Earth's Moon) 
then stated als -1)
// Column 8: longitude of ascending node (degrees; if variable (Earth's 
Moon) then stated als -1)
// Column 9: oblateness (not taken into account if different radii 
explicitly stated)
// Column 10: declination of north pole (degrees)
// Column 11: right ascension of north pole (degrees!)
// Column 12: albedo (if irrelevant (Sun) stated as -1)

#declare bodies = array [74][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    } // 
72 - Saturn

[...]

}

// PROVISIONAL PLANETARY POSITIONS (to be replaced later according to 
astronomically accurate orbital data)

[...]

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

[...]

// CAMERA DATA

#switch(cam)
[...]
   #case (7) // centered on Saturn, rings oblique view
     #declare camPos = Pos_Saturn + 350000 * <sin(radians(64)), 0, 
cos(radians(64))>;
     #declare camLook = Pos_Saturn;
     #declare camAng = 40;
   #break
   #case (7.01) // view through Saturn's D ring
     #declare camPos = Pos_Saturn + 350000 * <sin(radians(64)), 0, 
cos(radians(64))>;
     #declare camLook = Pos_Saturn+<10000, -32000, 0>;
     #declare camAng = 5;
   #break
   #case (7.02) // 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

// CELESTIAL SPHERE
Stars(6, image_width, camAng, 1.5) // invocation of starry sky sphere macro

#macro SetAxis(dec, ras) // macro for orienting planets
   rotate <bodies[3][4]-(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])
     }
   }
}

[...]

// the following three image files can be obtained at 
http://www.mmedia.is/~bjj/data/s_rings/index.html

#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"
   }
}

#declare Saturn_Rings_UnlitSide =
pigment
{
   image_map
   {
     png "solarsys/unlitside_bjoernjonsson.png"
   }
}


currently not yet working with media! (but that would be another thread 
here!)

#declare Ring_Color_Map_1_to_255 =
     color_map
     {
       #declare a=0;
       #while (a<255)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }

#declare Ring_Color_Map_256_to_510 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=255;
       #while (a<510)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings }
}

#declare Ring_Color_Map_511_to_765 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=510;
       #while (a<765)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings }
}

#declare Ring_Color_Map_766_to_1020 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=765;
       #while (a<1020)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings }
}

#declare Ring_Color_Map_1021_to_1275 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=1020;
       #while (a<1275)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings }
}

#declare Ring_Color_Map_1276_to_1500 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=1275;
       #while (a<1500)
         #declare c=eval_pigment(Saturn_Rings_Colors, <2999/3000-a/1500, 
0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings }
}


#declare Ring_UnlitSide_Map_1_to_255 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=0;
       #while (a<255)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

#declare Ring_UnlitSide_Map_256_to_510 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=255;
       #while (a<510)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

#declare Ring_UnlitSide_Map_511_to_765 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=510;
       #while (a<765)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

#declare Ring_UnlitSide_Map_766_to_1020 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=765;
       #while (a<1020)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

#declare Ring_UnlitSide_Map_1021_to_1275 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=1020;
       #while (a<1275)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

#declare Ring_UnlitSide_Map_1276_to_1500 =
texture
{
   pigment
   {
     cylindrical
     color_map
     {
       #declare a=1275;
       #while (a<1500)
         #declare c=eval_pigment(Saturn_Rings_UnlitSide, 
<2999/3000-a/1500, 0.5, 0>);
         #declare f=eval_pigment(Saturn_Rings_Transparency, 
<2999/3000-a/1500, 0.5, 0>);
         [a*(((140390-74510)/140390)/1500) rgb c filter f.gray]
         #declare a=a+1;
       #end
     }
   }
   finish { F_Saturn_Rings_UnlitSide }
}

// the actual planet and rings objects

union
{
sphere // Saturn
{
   0, 1
   texture
   {
     pigment
     {
       image_map
       {
         jpeg "solarsys/saturn_bjoernjonsson.jpg" // also from 
http://www.mmedia.is/~bjj/data/saturn/index.html
         map_type 1
         interpolate 2
       }
     }
     finish { F_Standard_Planetary_Surface }
   }
   scale <bodies[72][1], bodies[72][2], bodies[72][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
   }
   // originally used with the no-media hi-res version of the rings - 
I'm currently not sure whether I will able to make use of it also with 
media!
   /* cylinder // unlit side!
   {
     <0, -0.15, 0>/sc, <0, -0.1, 0>/sc, 150000/sc
     texture
     {
       cylindrical
       texture_map
       {
         [0                                   Ring_UnlitSide_Map_1_to_255 ]
         [255*(((140390-74510)/140390)/1500)  Ring_UnlitSide_Map_256_to_510]
         [510*(((140390-74510)/140390)/1500) 
Ring_UnlitSide_Map_511_to_765]
         [765*(((140390-74510)/140390)/1500) 
Ring_UnlitSide_Map_766_to_1020]
         [1020*(((140390-74510)/140390)/1500) 
Ring_UnlitSide_Map_1021_to_1275]
         [1275*(((140390-74510)/140390)/1500) 
Ring_UnlitSide_Map_1276_to_1500]
       }
       scale 140390/sc
     }
   } */
   // ultra-cheap no media version of the rings
   #if (lores)
     texture // low resolution texture: 255 entries in ring color map
     {
       pigment
       {
         cylindrical
         color_map
         {
           #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 filter f.gray]
             #declare a=a+1;
           #end
         }
         scale 140390/sc
       }
       finish { F_Saturn_Rings }
     }
   #else // current media problem!
     hollow
     pigment { rgbt 1 }
     interior
     {
       media
       {
         scattering
         {
           1, 1
           // eccentricity -0.4
           extinction 0.1
         }
         // absorption 0.095
         density
         {
           cylindrical
           // hi-res version (1500 color and transparency levels), 
currently not usable with media (but please let's discuss this later on!)
           /* density_map
           {
             [0                                   Ring_Color_Map_1_to_255]
             [255*(((140390-74510)/140390)/1500)  Ring_Color_Map_256_to_510]
             [510*(((140390-74510)/140390)/1500) 
Ring_Color_Map_511_to_765]
             [765*(((140390-74510)/140390)/1500) 
Ring_Color_Map_766_to_1020]
             [1020*(((140390-74510)/140390)/1500) 
Ring_Color_Map_1021_to_1275]
             [1275*(((140390-74510)/140390)/1500) 
Ring_Color_Map_1276_to_1500]
           } */
           // current media version
           color_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 /* filter f.gray*/]
               #declare a=a+1;
              #end
            }
            scale 11
         }
       }
     }
   #end
   }
   SetAxis(bodies[72][10], bodies[72][11])
   translate Pos_Saturn/sc
}

camera
{
   [...]
   location camPos/sc
   look_at camLook/sc
   angle camAng
}

// end of code

Attached image shows current state!

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'povsolar.png' (60 KB)

Preview of image 'povsolar.png'
povsolar.png


 

From: clipka
Subject: Re: Probably I'm just in fact too stupid...
Date: 9 Feb 2010 11:22:37
Message: <4b718bcd$1@news.povray.org>


>  >   Sorry, I did a poor reading, and for the images I assumed too 
> quickly your
>  > problem was just the ultra-bright media... trying with your code on 
> the last
>  > message, I see that using extinction 0 gives the effect you are 
> looking for.
> 
> Yes, that's quite logical... I tried it, and it at least yielded roughly 
> the result I want to achieve in the long run! Thank you for the tip... 
> perhaps I'll up the extinction value to, let's say, 0.1 or 0.15, as the 
> unlit side is of course somewhat darker than the lit side, irrespective 
> of light filtering through...

Just for completeness' sake: From a theoretical point of view, the 
"extinction" parameter is no good for your application, as it only 
accounts for light that fails to be transmitted due to being scattered 
away. As a consequence, only the scattered colors are attenuated 
accordingly.

This is good for modelling media in which the scattering is primarily 
due to diffraction or other interference effects (i.e. very small 
particles, like molecules or very fine dust), but does not properly 
model media containing larger objects in which the scattering is 
primarily due to reflection, as in that case all wavelengths will be 
obstructed, whether they are reflected (and therefore scattered) or not.

I guess in the case of the Saturn rings, reflection will be the primary 
scattering effect, so it should be modeled using...

- an absorbing media to account for the shadowing effect
- a scattering media to account for the reflected light

The scattering media, in this case, should indeed have "extinction 0", 
as the extinction component is already accounted for by the absorbing media.


Christoph


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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