Sky Interface¶

class simul::sky::SiderealSkyInterface¶
An abstract interface class for a sky that is calculated using sidereal data.
Subclassed by simul::sky::SiderealSky
Public Functions

virtual const float *SiderealToEarthMatrix(double epoch_time, float latitude, float longitude) const = 0¶
Get a 4x4 transformation matrix to transform sidereal coordinates into azimuth and elevation.

virtual const float *SiderealToEarthMatrix(double epoch_time, float latitude, float longitude) const = 0¶

class simul::sky::OpticalLengthInterface¶
An abstract interface class for skies that can calculate optical lengths.
Subclassed by simul::sky::Sky
Public Functions

virtual float GetOpticalLength(float Elevation, float h_km) const = 0¶
Get the effective optical length (equivalent length at sea level density) of a ray cast from altitude h_km at angle Elevation above the horizon.

virtual float GetHazeFactorOpticalLength(float Elevation, float h_km, HazeStruct hazeStruct) const = 0¶
Get the effective optical length of haze of a ray cast from altitude h_km at angle Elevation above the horizon.

virtual float GetOzoneOpticalLength(float Elevation, float h_km) const = 0¶
Get the effective optical length of ozone of a ray cast from altitude h_km at angle Elevation above the horizon.

virtual float GetOpticalLength(float Elevation, float h_km) const = 0¶

class simul::sky::BaseSkyInterface¶
An abstract interface class for skies.
Subclassed by simul::sky::SkyKeyframer
Public Functions
 Wavelengths in blue These values are used to calculate the Mie coefficients is MieWavelengthExponent is non and the Rayleigh coefficients if CalcAutomaticRayleighCoefficients is called VIRTUAL_Get (float, MieEccentricity,"Eccentricity of Mie (haze) scattering in the sky.") virtual vec3 GetDirectionToLight(double t
Get the direction to the current strongest light source  could be the sun or the moon.

virtual vec3 GetDirectionToLight(float altitude_km) const = 0¶
Get the direction to the current strongest light source  could be the sun or the moon.

virtual vec3 GetDirectionToSun() const = 0¶
Get the current direction to the sun.

virtual vec3 GetDirectionToSun(double t) const = 0¶
Get the direction to the Sun at the given time.

virtual vec3 GetDirectionToMoon(sky::uid, double t) const = 0¶
Get the direction to the Moon at the given time.

virtual vec3 GetLocalSunIrradiance(double t, float altitude_km) const = 0¶
Get the sunlight that reaches the altitude altitude_km.

virtual float4 GetLocalIrradiance(float altitude_km) const = 0¶
Get the sunlight that reaches the altitude altitude_km.

virtual float4 GetMieRayleighRatio() const = 0¶
Get the ratio of Mie to Rayleigh scattering at unit air and haze density. A useful helper function as some shaders use this ratio.

virtual vec3 GetSunlightTableTransformKm() const = 0¶
Get the transform vector to convert an altitude in km into a 1D texture coordinate for the sunlight table. x = multiplier, y=offset, so texcoord u=t.x*zkm+t.y;.

virtual float GetHorizonElevation(float h_km) const = 0¶
Get the horizon elevation from a given altitude.

virtual EarthShadow GetEarthShadow(float h_km, const vec3 &lightDir) const = 0¶
The Earth’s shadow, as seen from the given altitude.

virtual float4 GetInscatterAngularMultiplier(float cosine, float mie_factor, float alt_km) const = 0¶
Get the multiplier for an inscatter factor that gives the total inscatter, where cosine is the cosine between the angle to the sun and the ray direction, mie_factor is the proportional haze factor (stored int the w element of the inscatter factor) and alt_km is the viewing altitude in km.

virtual float GetVisibilityDistance(float view_alt_km) = 0¶
From the altitude specified, the distance in km to 10% visibility (mainly a factor of fog/haze).

virtual float GetHazeForVisibilityDistance(float view_alt_km, float horiz_dist_km) = 0¶
Get the haze that will produce the required visibility distance in the horizontal direction.

virtual float GetTemperatureKelvins(float h_km) const = 0¶
Return the temperature at the stated altitude in kelvins (subtract 273.15 to get celsius).

virtual unsigned GetSubdivisionChecksum() const = 0¶
When this checksum changes, the atmosphere has been modified sufficiently to warrant regeneration of tables.

class simul::sky::AtmosphericScatteringInterface¶
An abstract interface class for skies.
Subclassed by simul::sky::Sky
General <br>

virtual float GetMoonIrradianceFactor(const Moon &m, const vec3 &dir_to_moon, const vec3 &dir_to_sun) const = 0¶
Get the moonlight irradiance in space.

virtual vec3 GetLocalMoonIrradianceFactor(const Moon &m, float altitude_km, const vec3 &dir_to_moon, const vec3 &dir_to_sun, HazeStruct hazeStruct) const = 0¶
Get the moonlight that reaches the altitude altitude_km.

virtual vec3 GetLocalSunIrradiance(float altitude_km, const vec3 &sun_irradiance, const vec3 &dir_to_sun, HazeStruct hazeStruct) const = 0¶
Get the sunlight that reaches the altitude altitude_km.

virtual float4 GetColourLossFactor(const vec3 &view_pos_km, const vec3 &pos_km, HazeStruct hazeStruct, bool earth_test = false, int steps = 0) const = 0¶
Get the loss factor of an object at position pos_km seen from view_pos_km.
When an object has initial colour c, multiply each member of c by the corresponding member of the loss factor to get the colour as seen by the viewer.

virtual EarthShadow GetEarthShadow(float h_km, const vec3 &lightDir) const = 0¶
The Earth’s shadow, as seen from the given altitude.

virtual float4 GetIsotropicColourLossFactor(float alt_km, float elevation, float min_dist_km, float max_dist_km, HazeStruct hazeStruct, bool earth_test = false, int steps = 0, bool blackbody = false, float emissivity = 0.f) const = 0¶
Get the loss factor of an object at position pos_km seen from view_pos_km. When an object has initial colour c, multiply each member of c by the corresponding member of the loss factor to get the colour as seen by the viewer.

virtual float4 GetAnisotropicInscatterFactor(bool include_sunlight, float alt_km, float elevation, float min_dist_km, float max_dist_km, const vec3 &sun_irradiance, vec3 moon_albedo, const float4 &starlight, const vec3 &dir_to_sun, const std::map<uid, vec3> &moonDirections, HazeStruct hazeStruct, float4 wavelengthsNm, const OvercastStruct &overcast, bool earth_test, int steps) const = 0¶
Get the inscatter factor in the xyz  the 3element factor which is multiplied by the 3element factor Beta to get the inscattered colour. In the w element is the haze factor. This excludes skylight and starlight, which are not considered to be strongly anisotropic. See GetIsotropicInscatter().

virtual float4 GetIsotropicInscatter(float alt_km, float elevation, float min_dist_km, float max_dist_km, const vec3 &sun_irradiance, vec3 moon_albedo, const float4 &starlight, const vec3 &dir_to_sun, const std::map<uid, vec3> &moonDirections, HazeStruct hazeStruct, float4 wavelengthsNm, const OvercastStruct &overcast, bool earth_test = false, int steps = 0) const = 0¶
Get the approximate isotropic inscatter, i.e. the inscatter without a dependence on the angle to the strongest light source. In particular, this includes skylight and starlight.

virtual float4 GetBlackbodyInscatter(float alt_km, float elevation, float min_dist_km, float max_dist_km, const vec3 &sun_irradiance, vec3 moon_albedo, const float4 &starlight, const vec3 &dir_to_sun, const std::map<uid, vec3> &moonDirections, HazeStruct hazeStruct, float4 wavelengthsNm, bool earth_test = false, int steps = 0, float emissivity = 0.f) const = 0¶
Get the radiance due to blackbody radiation.

virtual float4 GetInscatterAngularMultiplier(float cosine, float mie_factor, HazeStruct hazeStruct) const = 0¶
Get the multiplier for an inscatter factor that gives the total inscatter, where cosine is the cosine between the angle to the sun and the ray direction, mie_factor is the proportional haze factor (stored int the w element of the inscatter factor) and alt_km is the viewing altitude in km.

virtual float GetVisibilityDistance(float view_alt_km, HazeStruct hazeStruct) = 0¶
From the altitude specified, the distance in km to 10% visibility (mainly a factor of fog/haze).

virtual float GetHazeForVisibilityDistance(float view_alt_km, float horiz_dist_km, HazeStruct hazeStruct) = 0¶
Get the haze that will produce the required visibility distance in the horizontal direction.

virtual float GetOzoneAtAltitude(float alt_km) const = 0¶
Get the amount of ozone present at altitude alt_km. This is a dimensionless number.

virtual float GetHazeFactorAtAltitude(float alt_km, HazeStruct hazeStruct) const = 0¶
Get the amount of haze present at altitude alt_km compared to the amount at sea level. This value is independent of the overall Haze multiplier ( see GetHaze() ).

virtual float GetOvercastAtAltitude(const OvercastStruct &overcast, float alt_km) const = 0¶
Get the strength of the overcast effect at a given altitude, determined by Overcast, OvercastBaseKm, and OvercastRangeKm.

virtual float4 GetSunlightFactor(float alt_km, const vec3 &DirectionToLight, HazeStruct hazeStruct) const = 0¶
Return the colour of sunlight passing through the stated altitude as a multiplier of the sun radiance in space.

virtual float GetDistanceToSpace(float Elevation, float h_km) const = 0¶
Considering the atmosphere as a shell of thickness GetAtmosphereThickness(), from altitude h_km, this function returns how far a ray cast at angle Elevation above the horizon would travel to reach the outer radius of the shell.

virtual float GetDistanceToEarth(float Elevation, float h_km) const = 0¶
From the specified altitude h_km, and in the direction of Elevation, how far is it in Km to the surface?
Public Functions
 VIRTUAL_GetAndSet (float, PlanetRadius,"Radius of the planet, default 6378 km (Earth)") VIRTUAL_GetAndSet(float
Calculate Rayleigh coefficients for air using colour wavelengths ColourWavelengthsNm.

virtual float GetMoonIrradianceFactor(const Moon &m, const vec3 &dir_to_moon, const vec3 &dir_to_sun) const = 0¶

struct HazeStruct¶
A data structure to contain haze properties in the atmosphere at any given moment.

struct OvercastStruct¶

struct LightingState¶

struct simul::sky::EarthShadow¶
Properties of the Earth’s shadow on the atmosphere and other objects.
Public Members

bool enable¶
If true, the Earth’s shadow should be visible above the horizon.

vec3 normal¶
normal is the direction normal to the sunlight direction

float radius_on_cylinder¶
radius_on_cylinder is the distance from the Earth’s centre to the viewpoint on the plane of the cylinder

float illumination_altitude¶
What altitude (in km) is the lowest that sunlight reaches, directly above/below the viewer.

float planet_radius¶
In km.

float terminator_distance_km¶
The shortest distance from the viewer TO the terminator, which will be in the direction TO the sun.

bool enable¶

struct Orbit¶

struct Moon¶