|
![](/i/fill.gif) |
On 10/01/10 15:30, David Given wrote:
[...]
> - I want to play with the atmospheric density function (to allow for the
> moon's very low gravity gradient). This means I need to adjust Bruno
> Cabasson's original code so that it doesn't depend on the height of the
> atmosphere. Unfortunately there's something about how to scale media
> that I'm just not getting --- the bigger I make the object containing
> the atmosphere, the less dense the atmosphere gets, regardless how I
> modify the density function. (Code below.)
I now realise that I forgot to attach the relevant bit of code for the
atmosphere that I wanted people to lookat. Whoops.
Nominal_Terrain_Radius and Sea_Level describe the size of the planet.
Atmospheric_Scale and Atmospheric_Depth describe the size of the
atmosphere. Atmospheric_Scale is a scale factor indicating the nominal
depth of the atmosphere; this should correspond to the original TerraPOV
'depth of atmosphere' field. Atmospheric_Depth describes the depth of
the actual atmosphere object. I want to be able to adjust
Atmospheric_Depth arbitrarily and have my media remain looking (largely)
the same.
#local Bottom_Of_Atmosphere = Nominal_Terrain_Radius + Sea_Level;
#local Top_Of_Atmosphere = Bottom_Of_Atmosphere
+ Atmospheric_Depth;
#local Base_Rayleigh_Power = 6.7;
// don't know what the following line means.
#local Rayleigh_Factor = 1 / Atmospheric_Scale;
#local Rayleigh_Scale = 1;
#local Rayleigh_Power = Base_Rayleigh_Power * Rayleigh_Factor;
#local Rayleigh_Density =
density
{
#local height_from_centre =
function(x, y, z) {
sqrt(x*x + y*y + z*z)
}
#local height_from_surface =
function(x, y, z) {
height_from_centre(x, y, z) - Bottom_Of_Atmosphere
}
function
{
Rayleigh_Scale * exp(
-Rayleigh_Power *
height_from_surface(x, y, z)
)
// this line doesn't work
* (Atmospheric_Scale / Atmospheric_Depth)
}
}
#local Rayleigh_Colour = rgb <0.2061, 0.3933, 1.0>;
#local Rayleigh_Media =
media
{
method 3 // adaptive
intervals 3
samples 3
scattering
{
RAYLEIGH_SCATTERING
color Rayleigh_Colour / Atmospheric_Scale
extinction 1
}
density
{
Rayleigh_Density
}
}
#local Sky_Object =
sphere
{
<0, 0, 0>, 1
pigment
{
rgbt 1
}
hollow
scale Top_Of_Atmosphere
interior
{
media
{
Rayleigh_Media
}
}
}
--
┌─── dg@cowlark.com ─────
http://www.cowlark.com ─────
│ "There does not now, nor will there ever, exist a programming
│ language in which it is the least bit hard to write bad programs." ---
│ Flon's Axiom
Post a reply to this message
|
![](/i/fill.gif) |