|
|
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'
|
|
|
|
"Sven Littkowski" <sve### [at] jamaica-focuscom> wrote:
> Hello Eagle Sun,
>
> I am trying out your macros but I need to know, which which options you are
> using them for your Saturn scene. Can you publish how you call these marcos?
>
> Only then I can try to help. I first need to re-achieve your results in
> order to understand the problem.
>
> Greetings,
>
> Sven
Here's the way I call it....
Saturn(0, 5, 0, 120, 0, -23.7)
TerragenViewFrom(1.414, 326381.5, 0, 0, 0)
If you mean "Atmosphere_Option", I chose "5". But same phenomenon is
reproduced no matter which option I choose.
The "TerragenViewFrom()" macro looks like this:
#macro TerragenViewFrom(_zoom, _fromobject, _shift_x, _shift_y, _shift_z)
camera
{
direction <0, 0, _zoom>
up y*image_height/image_width
right x*PixelRatio
look_at <_shift_x*unitscale, _shift_y*unitscale, _shift_z*unitscale>
location <0, 0, -(_fromobject*unitscale)>
}
#end
Here are comments that will provide a bit more explanation...
// Stars_Crackle(_heading, _pitch, _bank)
// Planet(_distance, _hour, _year, _heading, _pitch, _bank)
// Satellite(_sun, _distance, _hour, _year, _heading, _pitch, _bank)
// TerragenViewFrom(_zoom, _fromobject, _shift_x, _shift_y, _shift_z)
I've also tried a wide range of values for max_trace_level from 5 to 20.
The phenomenon has never gone away. As far as I can tell.... the objects
are 1) Isosurface, 2) hollow sphere with media (3), and 4) disks. At most
extreme liberal thought, I can't see any reason to go higher than 8.... but
what do I know, I'm a beginner.
Any planet image may be used for the map.
Let me know if you need more info...
Post a reply to this message
|
|