Time of Day
Public Member Functions | Public Attributes | Properties | List of all members
TOD_Sky Class Reference

Main sky dome management class. More...

Public Member Functions

Vector3 OrbitalToUnity (float radius, float theta, float phi)
 Convert spherical coordinates to cartesian coordinates. More...
 
Vector3 OrbitalToLocal (float theta, float phi)
 Convert spherical coordinates to cartesian coordinates. More...
 
Color SampleAtmosphere (Vector3 direction, bool directLight=true)
 Sample atmosphere colors from the sky dome. More...
 
SphericalHarmonicsL2 RenderToSphericalHarmonics ()
 Render the sky dome to 3rd order spherical harmonics.
 
SphericalHarmonicsL2 RenderToSphericalHarmonics (float intensity, float saturation)
 Render the sky dome to 3rd order spherical harmonics.
 
void RenderToCubemap (RenderTexture targetTexture=null)
 Render the sky dome to a cubemap render texture. More...
 
Color SampleFogColor (bool directLight=true)
 Calculate the fog color. More...
 
Color SampleSkyColor ()
 Calculate the sky color.
 
Color SampleEquatorColor ()
 Calculate the equator color.
 
void UpdateFog ()
 Update the RenderSettings fog color according to TOD_FogParameters.
 
void UpdateAmbient ()
 Update the RenderSettings ambient light according to TOD_AmbientParameters.
 
void UpdateReflection ()
 Update the RenderSettings reflection probe according to TOD_ReflectionParameters.
 
void LoadParameters (string xml)
 Load parameters at runtime. More...
 

Public Attributes

TOD_ColorSpaceType ColorSpace = TOD_ColorSpaceType.Auto
 Auto: Use the player settings. Linear: Force linear color space. Gamma: Force gamma color space.
 
TOD_ColorRangeType ColorRange = TOD_ColorRangeType.Auto
 Auto: Use the camera settings. HDR: Force high dynamic range. LDR: Force low dynamic range.
 
TOD_ColorOutputType ColorOutput = TOD_ColorOutputType.Dithered
 Raw: Write color without modifications. Dithered: Add dithering to reduce banding.
 
TOD_SkyQualityType SkyQuality = TOD_SkyQualityType.PerVertex
 Per Vertex: Calculate sky color per vertex. Per Pixel: Calculate sky color per pixel.
 
TOD_CloudQualityType CloudQuality = TOD_CloudQualityType.High
 Low: Only recommended for very old mobile devices. Medium: Simplified cloud shading. High: Physically based cloud shading.
 
TOD_MeshQualityType MeshQuality = TOD_MeshQualityType.High
 Low: Only recommended for very old mobile devices. Medium: Simplified mesh geometry. High: Detailed mesh geometry.
 
TOD_StarQualityType StarQuality = TOD_StarQualityType.High
 Low: Recommended for most mobile devices. Medium: Includes most visible stars. High: Includes all visible stars.
 
TOD_CycleParameters Cycle
 Parameters of the day and night cycle.
 
TOD_WorldParameters World
 Parameters of the world.
 
TOD_AtmosphereParameters Atmosphere
 Parameters of the atmosphere.
 
TOD_DayParameters Day
 Parameters of the day.
 
TOD_NightParameters Night
 Parameters of the night.
 
TOD_SunParameters Sun
 Parameters of the sun.
 
TOD_MoonParameters Moon
 Parameters of the moon.
 
TOD_StarParameters Stars
 Parameters of the stars.
 
TOD_CloudParameters Clouds
 Parameters of the cloud layers.
 
TOD_LightParameters Light
 Parameters of the light source.
 
TOD_FogParameters Fog
 Parameters of the fog.
 
TOD_AmbientParameters Ambient
 Parameters of the ambient light.
 
TOD_ReflectionParameters Reflection
 Parameters of the reflection cubemap.
 

Properties

static List< TOD_SkyInstances [get]
 All currently active sky dome instances.
 
static TOD_Sky Instance [get]
 The most recently created sky dome instance.
 
bool Initialized [get]
 Whether or not the sky dome was successfully initialized.
 
bool Headless [get]
 Whether or not the sky dome is running in headless mode.
 
TOD_Components Components [get]
 Containins references to all components.
 
TOD_Resources Resources [get]
 Containins references to all resources.
 
bool IsDay [get]
 Boolean to check if it is day.
 
bool IsNight [get]
 Boolean to check if it is night.
 
float Radius [get]
 Radius of the sky dome.
 
float Diameter [get]
 Diameter of the sky dome.
 
float LerpValue [get]
 Falls off the darker the sunlight gets. Can for example be used to lerp between day and night values in shaders.
= +1 at day
= 0 at night.
 
float SunZenith [get]
 Sun zenith angle in degrees.
= 0 if the sun is exactly at zenith.
= 90 if the sun is exactly at the horizon.
= 180 if the sun is exactly opposize to zenith.
 
float SunAltitude [get]
 Sun altitude angle in degrees.
= -90 if the sun is exactly opposite to zenith.
= 0 if the sun is exactly at the horizon.
= 90 if the sun is exactly at zenith.
 
float SunAzimuth [get]
 Sun azimuth angle in degrees.
= 0 if the sun is exactly in the north.
= 90 if the sun is exactly in the east.
= 180 if the sun is exactly in the south.
= 270 if the sun is exactly in the west.
 
float MoonZenith [get]
 Moon zenith angle in degrees.
= 0 if the moon is exactly at zenith.
= 180 if the moon is exactly below the ground.
 
float MoonAltitude [get]
 Moon altitude angle in degrees.
= -90 if the moon is exactly opposite to zenith.
= 0 if the moon is exactly at the horizon.
= 90 if the moon is exactly at zenith.
 
float MoonAzimuth [get]
 Moon azimuth angle in degrees.
= 0 if the moon is exactly in the north.
= 90 if the moon is exactly in the east.
= 180 if the moon is exactly in the south.
= 270 if the moon is exactly in the west.
 
float SunsetTime [get]
 Time the sun sets.
 
float SunriseTime [get]
 Time the sun rises.
 
float LocalSiderealTime [get]
 The current local sidereal time.
 
float LightZenith [get]
 Currently active light source zenith angle in degrees.
= 0 if the currently active light source (sun or moon) is exactly at zenith.
= 90 if the currently active light source (sun or moon) is exactly at the horizon.
 
float LightIntensity [get]
 Current light intensity.
 
float SunVisibility [get]
 Current sun visibility.
 
float MoonVisibility [get]
 Current moon visibility.
 
Vector3 SunDirection [get]
 Sun direction vector in world space.
 
Vector3 MoonDirection [get]
 Moon direction vector in world space.
 
Vector3 LightDirection [get]
 Current directional light vector in world space. Lerps between TOD_Sky.SunDirection and TOD_Sky.MoonDirection at dusk and dawn.
 
Vector3 LocalSunDirection [get]
 Sun direction vector in sky dome object space.
 
Vector3 LocalMoonDirection [get]
 Moon direction vector in sky dome object space.
 
Vector3 LocalLightDirection [get]
 Current directional light vector in sky dome object space. Lerps between TOD_Sky.LocalSunDirection and TOD_Sky.LocalMoonDirection at dusk and dawn.
 
Color SunLightColor [get]
 Current sun light color.
 
Color MoonLightColor [get]
 Current moon light color.
 
Color LightColor [get]
 Current light color. The color of TOD_Sky.Components.LightSource.
 
Color SunRayColor [get]
 Current sun ray color.
 
Color MoonRayColor [get]
 Current moon ray color.
 
Color SunSkyColor [get]
 Current sun sky color.
 
Color MoonSkyColor [get]
 Current moon sky color.
 
Color SunMeshColor [get]
 Current sun mesh color.
 
Color MoonMeshColor [get]
 Current moon mesh color.
 
Color SunCloudColor [get]
 Current sun cloud color.
 
Color MoonCloudColor [get]
 Current moon cloud color.
 
Color FogColor [get]
 Current fog color.
 
Color GroundColor [get]
 Current ground color.
 
Color AmbientColor [get]
 Current ambient light color.
 
Color MoonHaloColor [get]
 Current moon halo color.
 
ReflectionProbe Probe [get]
 Current reflection probe.
 

Detailed Description

Main sky dome management class.

Component of the sky dome parent game object.

Member Function Documentation

◆ LoadParameters()

void TOD_Sky.LoadParameters ( string  xml)
inline

Load parameters at runtime.

Parameters
xmlThe parameters to load, serialized to XML.

◆ OrbitalToLocal()

Vector3 TOD_Sky.OrbitalToLocal ( float  theta,
float  phi 
)
inline

Convert spherical coordinates to cartesian coordinates.

Parameters
thetaSpherical coordinates theta.
phiSpherical coordinates phi.
Returns
Unity position in local space.

◆ OrbitalToUnity()

Vector3 TOD_Sky.OrbitalToUnity ( float  radius,
float  theta,
float  phi 
)
inline

Convert spherical coordinates to cartesian coordinates.

Parameters
radiusSpherical coordinates radius.
thetaSpherical coordinates theta.
phiSpherical coordinates phi.
Returns
Unity position in world space.

◆ RenderToCubemap()

void TOD_Sky.RenderToCubemap ( RenderTexture  targetTexture = null)
inline

Render the sky dome to a cubemap render texture.

Parameters
targetTextureTarget RenderTexture in which rendering should be done.

◆ SampleAtmosphere()

Color TOD_Sky.SampleAtmosphere ( Vector3  direction,
bool  directLight = true 
)
inline

Sample atmosphere colors from the sky dome.

Parameters
directionView direction in world space.
directLightWhether or not to include direct light.
Returns
Color of the atmosphere in the specified direction.

◆ SampleFogColor()

Color TOD_Sky.SampleFogColor ( bool  directLight = true)
inline

Calculate the fog color.

Parameters
directLightWhether or not to include direct light.

The documentation for this class was generated from the following files: