Sky Interface¶

class 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 void GetSunPosition(float &azimuth, float &elevation, double epoch_time, float latitude, float longitude) const = 0¶

virtual void GetMoonPosition(float &azimuth, float &elevation, double epoch_time, float latitude, float longitude, const Orbit &orbit) const = 0¶

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

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

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

class 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, float distance_to_edge) const = 0¶

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, float distance_to_edge) const = 0¶

class BaseSkyInterface¶
An abstract interface class for skies.
Subclassed by simul::sky::SkyKeyframer
Private Functions

virtual vec3 GetDirectionToLight(double t, float altitude_km) const = 0¶
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 const LightingState &GetLightingState() const = 0¶
Get the current Lighting State, which holds the current direction to the Sun and Moon(s).

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.

virtual vec3 GetDirectionToLight(double t, float altitude_km) const = 0¶

class AtmosphericScatteringInterface¶
An abstract interface class for skies.
Subclassed by simul::sky::Sky
Public Functions

virtual vec3 GetDirectionToSun(double epoch_time, float latitude, float longitude) const = 0¶
Get the direction to the sun.

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 unsigned GetAtmosphericPropertiesChecksum() const = 0¶

virtual unsigned GetAtmosphericStateChecksum() const = 0¶

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?

virtual vec3 GetDirectionToSun(double epoch_time, float latitude, float longitude) const = 0¶

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

struct OvercastStruct¶

struct LightingState¶

struct 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¶
Variables to adjust the orbit of a Moon. Values here are default values for Earth’s Moon. See Moon Docs for more information.
Public Members

double LongitudeOfAscendingNode = 125.1228¶
The points in which the moon crosses the plane of the equator.

double LongitudeOfAscendingNodeRate = 0.0529538083¶
The amount the ascending node increases each day.

double Inclination = 5.1454¶
This controls the tilt angle of the orbit.

double ArgumentOfPericentre = 318.0634¶
This is the closest point of the moon to the Earths surface.

double ArgumentOfPericentreRate = 0.1643573223¶
The amount the argument of pericentre increases each day.

double MeanDistance = 60.2666¶
The average distance the moon is from the centre of the earth.

double Eccentricity = 0.054900¶
This controls how elliptical the orbit of the moon will be around the earth.

double MeanAnomaly = 115.3654¶
This controls the position that the moon will be around its orbit at midnight of each day.

double MeanAnomalyRate = 13.0649929509¶
This controls how much the mean anomaly changes each day.

double LongitudeOfAscendingNode = 125.1228¶

struct Moon¶
trueSKY supports multiple moons, each with their own orbit, size and texture.
Public Members

float radiusArcMinutes = 16.f¶
Radius of the moon in arc minutes.

std::string textureFilename¶
Filename of moon texture, including file extension.

vec3 colour = {0.136f, 0.136f, 0.136f}¶
Colour of moon and produced lighting.

float albedo = 0.136f¶
Amount of light reflected by the moon.

float radiusArcMinutes = 16.f¶