More structure for Aurora Borealis rendering in ALS
This commit is contained in:
parent
97cc53d7b3
commit
f08f21902c
3 changed files with 22 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
||||||
<aurora_strength><use>/environment/aurora/strength</use></aurora_strength>
|
<aurora_strength><use>/environment/aurora/strength</use></aurora_strength>
|
||||||
<aurora_vsize><use>/environment/aurora/vsize</use></aurora_vsize>
|
<aurora_vsize><use>/environment/aurora/vsize</use></aurora_vsize>
|
||||||
<aurora_hsize><use>/environment/aurora/hsize</use></aurora_hsize>
|
<aurora_hsize><use>/environment/aurora/hsize</use></aurora_hsize>
|
||||||
|
<aurora_ray_factor><use>/environment/aurora/ray-factor</use></aurora_ray_factor>
|
||||||
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
|
<lthickness><use>/environment/ground-haze-thickness-m</use></lthickness>
|
||||||
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
|
<terminator><use>/environment/terminator-relative-position-m</use></terminator>
|
||||||
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
|
<terrain_alt><use>/environment/mean-terrain-elevation-m</use></terrain_alt>
|
||||||
|
@ -158,6 +159,11 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>aurora_hsize</use></value>
|
<value><use>aurora_hsize</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>aurora_ray_factor</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>aurora_ray_factor</use></value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>horizon_roughness</name>
|
<name>horizon_roughness</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
|
|
@ -446,7 +446,7 @@
|
||||||
<vsize type="double" userarchive="n">0.4</vsize>
|
<vsize type="double" userarchive="n">0.4</vsize>
|
||||||
<hsize type="double" userarchive="n">0.4</hsize>
|
<hsize type="double" userarchive="n">0.4</hsize>
|
||||||
<patchiness type="double" userarchive="n">0.0</patchiness>
|
<patchiness type="double" userarchive="n">0.0</patchiness>
|
||||||
<ray-factor type="double" userarchive="n">1.0</ray-factor>
|
<ray-factor type="double" userarchive="n">0.0</ray-factor>
|
||||||
<upper-alt-factor type="double" userarchive="n">1.0</upper-alt-factor>
|
<upper-alt-factor type="double" userarchive="n">1.0</upper-alt-factor>
|
||||||
<penetration-factor type="double" userarchive="n">0.0</penetration-factor>
|
<penetration-factor type="double" userarchive="n">0.0</penetration-factor>
|
||||||
<afterglow type="double" userarchive="n">0.0</afterglow>
|
<afterglow type="double" userarchive="n">0.0</afterglow>
|
||||||
|
|
|
@ -32,6 +32,7 @@ uniform float parhelic;
|
||||||
uniform float aurora_strength;
|
uniform float aurora_strength;
|
||||||
uniform float aurora_hsize;
|
uniform float aurora_hsize;
|
||||||
uniform float aurora_vsize;
|
uniform float aurora_vsize;
|
||||||
|
uniform float aurora_ray_factor;
|
||||||
uniform float landing_light1_offset;
|
uniform float landing_light1_offset;
|
||||||
uniform float landing_light2_offset;
|
uniform float landing_light2_offset;
|
||||||
uniform float landing_light3_offset;
|
uniform float landing_light3_offset;
|
||||||
|
@ -93,6 +94,11 @@ void main()
|
||||||
float cbeta = dot ( normalize(lightFull.xy), normalize(nView.xy));
|
float cbeta = dot ( normalize(lightFull.xy), normalize(nView.xy));
|
||||||
float costheta = ct;
|
float costheta = ct;
|
||||||
|
|
||||||
|
// some noise
|
||||||
|
|
||||||
|
float hNoise_03 = Noise2D(vec2(0.0,cphi), 0.3);
|
||||||
|
float hNoiseAurora = Noise2D(vec2(0.001 * osg_SimulationTime,cphi + nView.x + nView.y), 0.07) * 0.2 * aurora_ray_factor;
|
||||||
|
|
||||||
// position of the horizon line
|
// position of the horizon line
|
||||||
|
|
||||||
float lAltitude = alt + delta_z;
|
float lAltitude = alt + delta_z;
|
||||||
|
@ -131,16 +137,22 @@ void main()
|
||||||
float hArg = dot(nView, direction);
|
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_v = smoothstep(0.2 - 0.6 * aurora_vsize * (1.0 - 0.8* aurora_ray_factor) , 0.2 , costheta + hNoiseAurora) * (1.0- smoothstep(0.3, 0.3 + aurora_vsize, costheta + hNoiseAurora));
|
||||||
|
aurora_v *= (1.0 + 5.0 * aurora_ray_factor * (1.0 -smoothstep(0.2 - 0.6 * aurora_vsize * (1.0 - 0.8* aurora_ray_factor), 0.3, costheta + hNoiseAurora)));
|
||||||
|
|
||||||
float aurora_h = smoothstep(1.0 - aurora_hsize, 1.0, hArg);
|
float aurora_h = smoothstep(1.0 - aurora_hsize, 1.0, hArg);
|
||||||
float aurora_time = 0.01 * osg_SimulationTime;
|
float aurora_time = 0.01 * osg_SimulationTime;
|
||||||
|
|
||||||
vec3 auroraBaseColor = vec3 (0.0, 0.2, 0.1);
|
vec3 auroraBaseColor = vec3 (0.0, 0.2, 0.1);
|
||||||
|
|
||||||
|
float aurora_ray = mix(1.0, Noise2D(vec2(cbeta, 0.01 * aurora_time), 0.001), aurora_ray_factor);
|
||||||
|
|
||||||
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_visible_strength = 0.3 + 0.7 * Noise2D(vec2(costheta + aurora_time, 0.5 * nView.x + 0.3 * nView.y + aurora_time), 0.1) ;
|
||||||
|
aurora_visible_strength *= aurora_ray;
|
||||||
float aurora_fade_in = 1.0 - smoothstep(0.1, 0.2, length(color.rgb));
|
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;
|
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
|
// fog computations for a ground haze layer, extending from zero to lAltitude
|
||||||
|
@ -285,7 +297,7 @@ float hazeBlendAngle = max(0.01,1000.0/avisibility + 0.3 * (1.0 - smoothstep(500
|
||||||
float altFactor = smoothstep(-300.0, 0.0, delta_z);
|
float altFactor = smoothstep(-300.0, 0.0, delta_z);
|
||||||
float altFactor2 = 0.2 + 0.8 * smoothstep(-3000.0, 0.0, delta_z);
|
float altFactor2 = 0.2 + 0.8 * smoothstep(-3000.0, 0.0, delta_z);
|
||||||
hazeBlendAngle = hazeBlendAngle + 0.1 * altFactor;
|
hazeBlendAngle = hazeBlendAngle + 0.1 * altFactor;
|
||||||
hazeBlendAngle = hazeBlendAngle + (1.0-horizon_roughness) * altFactor2 * 0.1 * Noise2D(vec2(0.0,cphi), 0.3);
|
hazeBlendAngle = hazeBlendAngle + (1.0-horizon_roughness) * altFactor2 * 0.1 * hNoise_03;
|
||||||
|
|
||||||
terrainHazeColor = clamp(terrainHazeColor,0.0,1.0);
|
terrainHazeColor = clamp(terrainHazeColor,0.0,1.0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue