1
0
Fork 0

Support for Aurora Boeralis for ALS skydome and Earthview

This commit is contained in:
Thorsten Renk 2016-01-10 10:07:21 +02:00
parent 7ab9b4be4f
commit 3ab3ba72e6
7 changed files with 1975 additions and 20 deletions

View file

@ -12,6 +12,10 @@
<avisibility><use>/environment/visibility-m</use></avisibility>
<ice_hex_col><use>/environment/scattering-phenomena/ice-hexagonal-column-factor</use></ice_hex_col>
<ice_hex_sheet><use>/environment/scattering-phenomena/ice-hexagonal-sheet-factor</use></ice_hex_sheet>
<parhelic><use>/environment/scattering-phenomena/parhelic-factor</use></parhelic>
<aurora_strength><use>/environment/aurora/strength</use></aurora_strength>
<aurora_vsize><use>/environment/aurora/vsize</use></aurora_vsize>
<aurora_hsize><use>/environment/aurora/hsize</use></aurora_hsize>
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
@ -129,11 +133,31 @@
<type>float</type>
<value><use>ice_hex_col</use></value>
</uniform>
<uniform>
<name>parhelic</name>
<type>float</type>
<value><use>parhelic</use></value>
</uniform>
<uniform>
<name>ice_hex_sheet</name>
<type>float</type>
<value><use>ice_hex_sheet</use></value>
</uniform>
<uniform>
<name>aurora_strength</name>
<type>float</type>
<value><use>aurora_strength</use></value>
</uniform>
<uniform>
<name>aurora_vsize</name>
<type>float</type>
<value><use>aurora_vsize</use></value>
</uniform>
<uniform>
<name>aurora_hsize</name>
<type>float</type>
<value><use>aurora_hsize</use></value>
</uniform>
<uniform>
<name>horizon_roughness</name>
<type>float</type>

View file

@ -435,7 +435,21 @@
<scattering-phenomena>
<ice-hexagonal-column-factor type="double" userarchive="n">0.0</ice-hexagonal-column-factor>
<ice-hexagonal-sheet-factor type="double" userarchive="n">0.0</ice-hexagonal-sheet-factor>
<parhelic-factor type="double" userarchive="n">0.0</parhelic-factor>
</scattering-phenomena>
<!-- definitions for aurorae -->
<aurora>
<strength type="double" userarchive="n">0.0</strength>
<vsize type="double" userarchive="n">0.4</vsize>
<hsize type="double" userarchive="n">0.4</hsize>
<patchiness type="double" userarchive="n">0.0</patchiness>
<ray-factor type="double" userarchive="n">1.0</ray-factor>
<upper-alt-factor type="double" userarchive="n">1.0</upper-alt-factor>
<penetration-factor type="double" userarchive="n">0.0</penetration-factor>
<afterglow type="double" userarchive="n">0.0</afterglow>
</aurora>
<!-- definitions for the environment at surface interface -->
<surface>
@ -445,6 +459,7 @@
<wetness-set type="double" userarchive="y">0.0</wetness-set>
<wetness type="double" userarchive="n">0.0</wetness>
<snow-thickness-factor type="double" userarchive="y">1.0</snow-thickness-factor>
</surface>
<!-- definitions for lightning functionality -->

49
Models/Astro/aurora.xml Normal file
View file

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<PropertyList>
<path>aurora_projection.ac</path>
<animation>
<type>scale</type>
<x-offset>58030</x-offset>
<y-offset>58030</y-offset>
<z-offset>58030</z-offset>
</animation>
<animation>
<enable-hot type="bool">false</enable-hot>
</animation>
<animation>
<type>rotate</type>
<property>/earthview/yaw-deg</property>
<factor>1</factor>
<offset-deg>0</offset-deg>
<center>
<x-m>0</x-m>
<y-m>0</y-m>
<z-m>0</z-m>
</center>
<axis>
<x>0</x>
<y>0</y>
<z>1</z>
</axis>
</animation>
<effect>
<inherits-from>Effects/planet-aurora</inherits-from>
<object-name>aurora</object-name>
</effect>
</PropertyList>

File diff suppressed because it is too large Load diff

View file

@ -80,6 +80,7 @@ else {setprop("/earthview/show-s4", 1);}
earth_model.node = earthview.place_earth_model("Models/Astro/earth.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node = earthview.place_earth_model("Models/Astro/cloudsphere.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
cloudsphere_model.node = earthview.place_earth_model("Models/Astro/aurora.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
# set Basic Weather off
props.globals.getNode("/environment/config/enabled").setBoolValue(0);

View file

@ -15,10 +15,6 @@ uniform sampler2D structure_texture;
float Noise2D(in vec2 coord, in float wavelength);
float luminance(vec3 color)
{
return dot(vec3(0.212671, 0.715160, 0.072169), color);
}
void main()
{

View file

@ -28,9 +28,14 @@ uniform float cloud_self_shading;
uniform float horizon_roughness;
uniform float ice_hex_col;
uniform float ice_hex_sheet;
uniform float parhelic;
uniform float aurora_strength;
uniform float aurora_hsize;
uniform float aurora_vsize;
uniform float landing_light1_offset;
uniform float landing_light2_offset;
uniform float landing_light3_offset;
uniform float osg_SimulationTime;
uniform int use_searchlight;
uniform int use_landing_light;
@ -76,10 +81,18 @@ float rayleighPhase(in float cosTheta)
void main()
{
//vec3 shadedFogColor = vec3(0.65, 0.67, 0.78);
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
vec3 shadedFogColor = vec3(0.55, 0.67, 0.88);
float cosTheta = dot(normalize(eye), gl_LightSource[0].position.xyz);
// some geometry
vec3 nView = normalize(viewVector);
vec3 lightFull = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz);
float calpha = dot(lightFull, nView);
float cbeta = dot ( normalize(lightFull.xy), normalize(nView.xy));
float costheta = ct;
// position of the horizon line
float lAltitude = alt + delta_z;
@ -102,28 +115,41 @@ void main()
float ovc = overcast;
float sat = 1.0 - ((1.0 - saturation) * 2.0);
if (sat < 0.3) sat = 0.3;
if (color.r > 0.58) color.r = 1.0 - exp(-1.5 * color.r);
if (color.g > 0.58) color.g = 1.0 - exp(-1.5 * color.g);
if (color.b > 0.58) color.b = 1.0 - exp(-1.5 * color.b);
if (color.r > 0.58) color.r = 1.0 - exp(-1.5 * color.r);
if (color.g > 0.58) color.g = 1.0 - exp(-1.5 * color.g);
if (color.b > 0.58) color.b = 1.0 - exp(-1.5 * color.b);
// Aurora Borealis / Australis
vec3 direction = vec3 (-1.0, 0.0, 0.0);
float hArg = dot(nView, direction);
float aurora_v = smoothstep(0.2 - 0.6 * aurora_vsize, 0.2, costheta) * (1.0- smoothstep(0.3, 0.3 + aurora_vsize, costheta));
float aurora_h = smoothstep(1.0 - aurora_hsize, 1.0, hArg);
float aurora_time = 0.01 * osg_SimulationTime;
vec3 auroraBaseColor = vec3 (0.0, 0.2, 0.1);
float aurora_visible_strength = 0.3 + 0.7 * Noise2D(vec2(costheta + aurora_time, 0.5 * nView.x + 0.3 * nView.y + aurora_time), 0.1) ;
float aurora_fade_in = 1.0 - smoothstep(0.1, 0.2, length(color.rgb));
color.rgb += auroraBaseColor * aurora_v * aurora_h * aurora_fade_in * aurora_visible_strength * aurora_strength;
// fog computations for a ground haze layer, extending from zero to lAltitude
float transmission;
float vAltitude;
float delta_zv;
float costheta = ct;
float vis = min(visibility, avisibility);
@ -196,16 +222,22 @@ oColor = intensity * normalize(mix(oColor, shadedFogColor, (smoothstep(0.1,1.0,
// ice crystal halo
vec3 nView = normalize(viewVector);
vec3 lightFull = normalize((gl_ModelViewMatrixInverse * gl_LightSource[0].position).xyz);
float sun_altitude = dot (lightFull, vec3 (0.0, 0.0, 1.0));
float calpha = dot(lightFull, nView);
float cbeta = dot ( normalize(lightFull.xy), normalize(nView.xy));
float view_altitude = dot(nView, vec3 (0.0, 0.0, 1.0));
float halo_ring_enhancement = smoothstep (0.88, 0.927, calpha) * (1.0 - smoothstep(0.927, 0.98, calpha));
//float halo_ring_enhancement = smoothstep (0.88, 0.927, calpha) * (1.0 - smoothstep(0.927, 0.98, calpha));
float halo_ring_enhancement = smoothstep (0.88, 0.927, calpha) * (1.0 - smoothstep(0.927, 0.94, calpha));
halo_ring_enhancement *= halo_ring_enhancement;
// parhelic circle
float parhelic_circle_enhancement = 0.3 * smoothstep (sun_altitude-0.01, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.01, view_altitude));
parhelic_circle_enhancement += 0.8 * smoothstep (sun_altitude-0.08, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.08, view_altitude));
parhelic_circle_enhancement *= parhelic * (0.2 + 0.8 * smoothstep(0.5, 1.0, cbeta));
// sundogs
float side_sun_enhancement = smoothstep (sun_altitude-0.03, sun_altitude, view_altitude) * (1.0 - smoothstep(sun_altitude, sun_altitude+ 0.03, view_altitude));
@ -224,6 +256,7 @@ pillar_enhancement *= beta_thickness * beta_thickness * smoothstep(0.99, 1.0,
float scattering_enhancements = 0.25 * halo_ring_enhancement * ovc;
scattering_enhancements += side_sun_enhancement *0.4 * (1.0 - smoothstep(0.6, 0.95, transmission));
scattering_enhancements += pillar_enhancement *0.25 * (1.0 - smoothstep(0.7, 1.0, transmission));
scattering_enhancements += parhelic_circle_enhancement * 0.2 * (1.0 - smoothstep(0.7, 1.0, transmission));
color.rgb += vec3(1.0, 1.0, 1.0) * (5.0-4.0* earthShade) * scattering_enhancements * hazeColor;
@ -305,6 +338,8 @@ color = mix(hColor+secondary_light * fog_backscatter(avisibility),color, transmi
gl_FragColor = vec4(color, 1.0);
gl_FragDepth = 0.1;
//gl_FragColor.rgb *= aurora_v * aurora_h;
//float test = dot (normalize(relVector), vec3 (0.0, 0.0, 1.0));
//gl_FragColor = vec4(test, test, test, 1.0);
}