|
|
High!
Reactor wrote:
> That code really wasn't quite what I'd expected. It lacked the various
> declarations required to actually make it work, and contained a lot of
> extraneous code. I do understand if there are some things you do not wish to
> share, but could you provide a minimal scene with only the relevant parts? This
> should be just the ring object, a basic media declaration (this doesn't have to
> include the special color_map, but it should be similar in color), and a
> light_source placed similarly to the real scene.
O.k., once more:
[...]
#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
{
5, 1
eccentricity -0.4
extinction 0
}
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
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 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
Ring color and transparency maps are at
http://www.mmedia.is/~bjj/data/s_rings/index.html
See you in Khyberspace!
Yadgar
Post a reply to this message
|
|