Earthview 2.1 - parallax mapping for cloud layer, lightning at night, Rayleigh scattering in atmosphere and minor bugfixes
This commit is contained in:
parent
3d409359af
commit
48768ee9d2
16 changed files with 2257 additions and 1963 deletions
|
@ -26,6 +26,7 @@
|
||||||
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
|
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
|
||||||
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
|
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
|
||||||
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
|
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||||
|
<arc_id>0.0</arc_id>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,9 +78,9 @@
|
||||||
<shade-model>
|
<shade-model>
|
||||||
<use>shade-model</use>
|
<use>shade-model</use>
|
||||||
</shade-model>
|
</shade-model>
|
||||||
<cull-face>
|
<!--<cull-face>
|
||||||
<use>cull-face</use>
|
<use>cull-face</use>
|
||||||
</cull-face>
|
</cull-face>-->
|
||||||
<rendering-hint>
|
<rendering-hint>
|
||||||
<use>rendering-hint</use>
|
<use>rendering-hint</use>
|
||||||
</rendering-hint>
|
</rendering-hint>
|
||||||
|
@ -87,7 +88,7 @@
|
||||||
<write-mask>false</write-mask>
|
<write-mask>false</write-mask>
|
||||||
</depth>
|
</depth>
|
||||||
<render-bin>
|
<render-bin>
|
||||||
<bin-number>10</bin-number>
|
<bin-number>111</bin-number>
|
||||||
<bin-name>DepthSortedBin</bin-name>
|
<bin-name>DepthSortedBin</bin-name>
|
||||||
</render-bin>
|
</render-bin>
|
||||||
<texture-unit>
|
<texture-unit>
|
||||||
|
@ -164,6 +165,11 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>brightness</use></value>
|
<value><use>brightness</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>arc_id</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>arc_id</use></value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>use_filtering</name>
|
<name>use_filtering</name>
|
||||||
<type>bool</type>
|
<type>bool</type>
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<shade-effect><use>/earthview/shade-effect</use></shade-effect>
|
<shade-effect><use>/earthview/shade-effect</use></shade-effect>
|
||||||
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
|
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
|
||||||
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||||
|
<roi_x1><use>/earthview/roi-x1</use></roi_x1>
|
||||||
|
<roi_y1><use>/earthview/roi-y1</use></roi_y1>
|
||||||
|
<lightning><use>/earthview/lightning</use></lightning>
|
||||||
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
|
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
|
||||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||||
|
@ -34,6 +37,7 @@
|
||||||
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
|
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
|
||||||
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
|
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
|
||||||
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
|
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||||
|
|
||||||
</parameters>
|
</parameters>
|
||||||
<generate>
|
<generate>
|
||||||
<normal type="int">15</normal>
|
<normal type="int">15</normal>
|
||||||
|
@ -195,6 +199,27 @@
|
||||||
<use>sun-angle</use>
|
<use>sun-angle</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>lightning</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>lightning</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>roi_x1</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>roi_x1</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>roi_y1</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>roi_y1</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>gamma</name>
|
<name>gamma</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<!-- DIFFUSE -->
|
<!-- DIFFUSE -->
|
||||||
</material>
|
</material>
|
||||||
<visibility><use>/environment/visibility-m</use></visibility>
|
<visibility><use>/environment/visibility-m</use></visibility>
|
||||||
|
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||||
<use-clouds><use>/earthview/cloudsphere-flag</use></use-clouds>
|
<use-clouds><use>/earthview/cloudsphere-flag</use></use-clouds>
|
||||||
<use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
|
<use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
|
||||||
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
||||||
|
@ -196,6 +197,13 @@
|
||||||
<use>visibility</use>
|
<use>visibility</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>air_pollution</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>air_pollution</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>sun_angle</name>
|
<name>sun_angle</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
@ -412,6 +420,13 @@
|
||||||
<use>visibility</use>
|
<use>visibility</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>air_pollution</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>air_pollution</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>sun_angle</name>
|
<name>sun_angle</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
|
9
Models/Astro/Effects/aurora_inner.eff
Executable file
9
Models/Astro/Effects/aurora_inner.eff
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<PropertyList>
|
||||||
|
<name>aurora_inner</name>
|
||||||
|
<inherits-from>Effects/planet-aurora</inherits-from>
|
||||||
|
<parameters>
|
||||||
|
<arc_id>1.0</arc_id>
|
||||||
|
</parameters>
|
||||||
|
</PropertyList>
|
|
@ -1,49 +1,11 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
<path>aurora_projection.ac</path>
|
<model>
|
||||||
|
<path>aurora_inner.xml</path>
|
||||||
|
</model>
|
||||||
<animation>
|
<model>
|
||||||
<type>scale</type>
|
<path>aurora_outer.xml</path>
|
||||||
<x-offset>58030</x-offset>
|
</model>
|
||||||
<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>
|
</PropertyList>
|
||||||
|
|
43
Models/Astro/aurora_inner.xml
Executable file
43
Models/Astro/aurora_inner.xml
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<PropertyList>
|
||||||
|
<path>aurora_projection.ac</path>
|
||||||
|
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>scale</type>
|
||||||
|
<x-offset>51030</x-offset>
|
||||||
|
<y-offset>51030</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>Models/Astro/Effects/aurora_inner</inherits-from>
|
||||||
|
<object-name>aurora</object-name>
|
||||||
|
</effect>
|
||||||
|
|
||||||
|
</PropertyList>
|
49
Models/Astro/aurora_outer.xml
Executable file
49
Models/Astro/aurora_outer.xml
Executable 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>
|
|
@ -2,6 +2,39 @@
|
||||||
# Earthview orbital rendering
|
# Earthview orbital rendering
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
|
||||||
|
var lightning_table = [];
|
||||||
|
|
||||||
|
var entry = [2.85, 30.28, 0.35, 0.045];
|
||||||
|
append(lightning_table, entry);
|
||||||
|
|
||||||
|
entry = [9.3,8.0,0.1, 0.105];
|
||||||
|
append(lightning_table, entry);
|
||||||
|
|
||||||
|
entry = [6.0, -72.0, 0.2, 0.09];
|
||||||
|
append(lightning_table, entry);
|
||||||
|
|
||||||
|
entry = [30.89, -112.0, 0.72, 0.34];
|
||||||
|
append(lightning_table, entry);
|
||||||
|
|
||||||
|
|
||||||
|
var check_lightning_table = func (lat, lon) {
|
||||||
|
|
||||||
|
for (var i=0; i< size(lightning_table); i=i+1)
|
||||||
|
{
|
||||||
|
if (math.abs(lat - lightning_table[i][0]) < 15.0)
|
||||||
|
{
|
||||||
|
if (math.abs(lon - lightning_table[i][1]) < 15.0)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var start = func() {
|
var start = func() {
|
||||||
|
|
||||||
if (earthview_running_flag ==1) {return;}
|
if (earthview_running_flag ==1) {return;}
|
||||||
|
@ -75,7 +108,7 @@ setprop("/environment/visibility-m", 80000.0);
|
||||||
setprop("/sim/rendering/mie", 0.0);
|
setprop("/sim/rendering/mie", 0.0);
|
||||||
setprop("/sim/rendering/rayleigh", 0.00002);
|
setprop("/sim/rendering/rayleigh", 0.00002);
|
||||||
setprop("/sim/rendering/dome-density", 1.0);
|
setprop("/sim/rendering/dome-density", 1.0);
|
||||||
setprop("/earthview/shade-effect", 1.5);
|
setprop("/earthview/shade-effect", 0.5);
|
||||||
|
|
||||||
earth_model.l1 = setlistener("/earthview/show-n1", func(n) {load_sector (1, n);},0,0);
|
earth_model.l1 = setlistener("/earthview/show-n1", func(n) {load_sector (1, n);},0,0);
|
||||||
earth_model.l2 = setlistener("/earthview/show-n2", func(n) {load_sector (2, n);},0,0);
|
earth_model.l2 = setlistener("/earthview/show-n2", func(n) {load_sector (2, n);},0,0);
|
||||||
|
@ -89,6 +122,8 @@ earth_model.l8 = setlistener("/earthview/show-s4", func(n) {load_sector (8, n);}
|
||||||
|
|
||||||
control_loop();
|
control_loop();
|
||||||
|
|
||||||
|
slow_loop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var stop = func () {
|
var stop = func () {
|
||||||
|
@ -289,6 +324,71 @@ if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {control_loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var slow_loop = func {
|
||||||
|
|
||||||
|
if (earthview_running_flag == 0) {return;}
|
||||||
|
|
||||||
|
# thunderstorms
|
||||||
|
|
||||||
|
var lat = getprop("/position/latitude-deg");
|
||||||
|
var lon = getprop("/position/longitude-deg") + getprop("/earthview/cloudsphere-angle");
|
||||||
|
|
||||||
|
|
||||||
|
var index = check_lightning_table(lat, lon);
|
||||||
|
|
||||||
|
if (index > -1)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
rn = rand();
|
||||||
|
|
||||||
|
if (rn < 0.3)
|
||||||
|
{
|
||||||
|
var roi_x_base = lightning_table[index][2];
|
||||||
|
var roi_y_base = lightning_table[index][3];
|
||||||
|
|
||||||
|
var rn = 0.005 * (2.0 * rand() - 0.5);
|
||||||
|
setprop("/earthview/roi-x1", roi_x_base + rn);
|
||||||
|
|
||||||
|
rn = 0.005 * (2.0 * rand() - 0.5);
|
||||||
|
setprop("/earthview/roi-y1", roi_y_base + rn);
|
||||||
|
|
||||||
|
|
||||||
|
lightning_strike();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getprop("/earthview/control_loop_flag") ==1) {settimer( func {slow_loop(); },1.0);}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var lightning_strike = func {
|
||||||
|
|
||||||
|
var rn = rand();
|
||||||
|
|
||||||
|
var repeat = 1;
|
||||||
|
|
||||||
|
if (rn > 0.5) {repeat = 2;}
|
||||||
|
|
||||||
|
var duration = 0.1 + 0.1 * rand();
|
||||||
|
var strength = 0.5 + 1.0 * rand();
|
||||||
|
|
||||||
|
setprop("/earthview/lightning", strength);
|
||||||
|
settimer( func{ setprop("/earthview/lightning", 0.0);}, duration);
|
||||||
|
|
||||||
|
var duration1 = 0.1 + 0.1 * rand();
|
||||||
|
|
||||||
|
if (repeat == 2)
|
||||||
|
{
|
||||||
|
settimer( func{ setprop("/earthview/lightning", strength);}, duration + 0.1);
|
||||||
|
settimer( func{ setprop("/earthview/lightning", 0.0);}, duration + 0.1 + duration1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# rotate position of cloud tiles
|
# rotate position of cloud tiles
|
||||||
|
|
||||||
var adjust_cloud_tiles = func {
|
var adjust_cloud_tiles = func {
|
||||||
|
|
|
@ -14,6 +14,7 @@ uniform float upper_alt_factor;
|
||||||
uniform float penetration_factor;
|
uniform float penetration_factor;
|
||||||
uniform float patchiness;
|
uniform float patchiness;
|
||||||
uniform float afterglow;
|
uniform float afterglow;
|
||||||
|
uniform float arc_id;
|
||||||
uniform float osg_SimulationTime;
|
uniform float osg_SimulationTime;
|
||||||
|
|
||||||
float Noise2D(in vec2 coord, in float wavelength);
|
float Noise2D(in vec2 coord, in float wavelength);
|
||||||
|
@ -23,11 +24,12 @@ void main()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
float vCoord = abs(vertex.z);
|
|
||||||
|
float vCoord = abs(vertex.z) - 0.02 * arc_id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float aurora_time = 0.001 * osg_SimulationTime;
|
float aurora_time = 0.001 * osg_SimulationTime + arc_id;
|
||||||
|
|
||||||
float noise_01 = Noise2D( vec2(vertex.x +aurora_time, vertex.y), 0.05);
|
float noise_01 = Noise2D( vec2(vertex.x +aurora_time, vertex.y), 0.05);
|
||||||
float blend_factor = smoothstep(0.935, 0.955, vCoord - 0.001 * noise_01 - 0.02 * (1.0-upper_alt_factor));
|
float blend_factor = smoothstep(0.935, 0.955, vCoord - 0.001 * noise_01 - 0.02 * (1.0-upper_alt_factor));
|
||||||
|
|
|
@ -4,6 +4,10 @@ varying vec3 vertex;
|
||||||
varying vec3 normal;
|
varying vec3 normal;
|
||||||
varying vec3 relVec;
|
varying vec3 relVec;
|
||||||
|
|
||||||
|
uniform float osg_SimulationTime;
|
||||||
|
uniform float arc_id;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -11,5 +15,14 @@ void main()
|
||||||
vertex = gl_Vertex.xyz;
|
vertex = gl_Vertex.xyz;
|
||||||
vec3 ep = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xyz;
|
vec3 ep = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xyz;
|
||||||
relVec = vertex - ep;
|
relVec = vertex - ep;
|
||||||
gl_Position = ftransform();
|
|
||||||
|
vec4 vert_out = gl_Vertex;
|
||||||
|
|
||||||
|
float ang = dot(vert_out.xy, vec2 (0.0, 1.0));
|
||||||
|
|
||||||
|
vert_out.x *= (1.0 + 0.05 * sin(ang + 0.1 * osg_SimulationTime + arc_id));
|
||||||
|
vert_out.y *= (1.0 + 0.05 * sin(ang + 0.12 * osg_SimulationTime + arc_id));
|
||||||
|
|
||||||
|
|
||||||
|
gl_Position = gl_ModelViewProjectionMatrix * vert_out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,10 @@ uniform float shade_effect;
|
||||||
uniform float sun_angle;
|
uniform float sun_angle;
|
||||||
uniform float air_pollution;
|
uniform float air_pollution;
|
||||||
|
|
||||||
|
uniform float roi_x1;
|
||||||
|
uniform float roi_y1;
|
||||||
|
uniform float lightning;
|
||||||
|
|
||||||
uniform bool use_overlay;
|
uniform bool use_overlay;
|
||||||
uniform bool use_cloud_normals;
|
uniform bool use_cloud_normals;
|
||||||
|
|
||||||
|
@ -32,6 +36,17 @@ return cos1 * cos2 + sign * sin1 * sin2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 lightning_color (in vec2 coord)
|
||||||
|
{
|
||||||
|
|
||||||
|
vec2 roi1 = vec2 (roi_x1, roi_y1);
|
||||||
|
|
||||||
|
float strength = 1.0 - smoothstep(0.0, 0.005, length(roi1 - coord));
|
||||||
|
|
||||||
|
return strength * vec3 (0.43, 0.57, 1.0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -71,6 +86,9 @@ void main()
|
||||||
vec3 binormal = cross(n, tangent);
|
vec3 binormal = cross(n, tangent);
|
||||||
float NdotL2 = 0.0;
|
float NdotL2 = 0.0;
|
||||||
|
|
||||||
|
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||||
|
ref_texel = texel;
|
||||||
|
|
||||||
if (use_cloud_normals)
|
if (use_cloud_normals)
|
||||||
{
|
{
|
||||||
vec2 sun2d = vec2 (0.0, 1.0);
|
vec2 sun2d = vec2 (0.0, 1.0);
|
||||||
|
@ -82,7 +100,18 @@ void main()
|
||||||
|
|
||||||
vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir);
|
vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir);
|
||||||
|
|
||||||
float slope = shade_effect * (comp_texel.a - ref_texel.a);
|
// parallax mapping
|
||||||
|
|
||||||
|
xOffset = -1.0 * dot(ecViewDir, tangent);
|
||||||
|
yOffset = -1.0 * dot(ecViewDir, binormal);
|
||||||
|
|
||||||
|
grad_dir = normalize (vec2 (xOffset, yOffset));
|
||||||
|
|
||||||
|
texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir * ref_texel.a * 0.7);
|
||||||
|
|
||||||
|
// relief shading based on gradient and parallax lookup
|
||||||
|
|
||||||
|
float slope = shade_effect * (comp_texel.a - ref_texel.a) * texel.a;
|
||||||
float sign = -1.0;
|
float sign = -1.0;
|
||||||
if (slope < 0.0) {sign = 1.0;}
|
if (slope < 0.0) {sign = 1.0;}
|
||||||
|
|
||||||
|
@ -90,8 +119,13 @@ void main()
|
||||||
|
|
||||||
NdotL2 = dot (snormal, sun2d);
|
NdotL2 = dot (snormal, sun2d);
|
||||||
NdotL = add_cosines(NdotL, NdotL2, sign );
|
NdotL = add_cosines(NdotL, NdotL2, sign );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
color += diff_term * max(NdotL, 0.15) ;
|
color += diff_term * max(NdotL, 0.15) ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,15 +135,13 @@ void main()
|
||||||
color.rgb *= smoothstep(-0.2, -0.1, NdotLraw);
|
color.rgb *= smoothstep(-0.2, -0.1, NdotLraw);
|
||||||
//
|
//
|
||||||
|
|
||||||
|
float darkness_fact = 1.0 - smoothstep(0.0,0.2, length(color.rgb));
|
||||||
|
color.rgb += lightning_color(gl_TexCoord[0].st) * (1.0 - texel.a) * lightning * darkness_fact;
|
||||||
|
|
||||||
|
|
||||||
color.a = diffuse_term.a;
|
color.a = 1.0;//diffuse_term.a;
|
||||||
color = clamp(color, 0.0, 1.0);
|
color = clamp(color, 0.0, 1.0);
|
||||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ref_texel = texel;
|
|
||||||
structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st);
|
structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st);
|
||||||
|
|
||||||
float noise = Noise2D( gl_TexCoord[0].st, 0.01);
|
float noise = Noise2D( gl_TexCoord[0].st, 0.01);
|
||||||
|
@ -129,6 +161,9 @@ void main()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
texel.a = clamp((1.0 + darkness_fact) * texel.a, 0.0, 1.0);
|
||||||
|
|
||||||
|
|
||||||
fragColor = color * texel;
|
fragColor = color * texel;
|
||||||
fragColor.rgb = filter_combined(fragColor.rgb);
|
fragColor.rgb = filter_combined(fragColor.rgb);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
||||||
varying vec3 VTangent;
|
varying vec3 VTangent;
|
||||||
|
|
||||||
uniform float visibility;
|
uniform float visibility;
|
||||||
|
uniform float air_pollution;
|
||||||
uniform float sun_angle;
|
uniform float sun_angle;
|
||||||
uniform bool use_clouds;
|
uniform bool use_clouds;
|
||||||
uniform bool use_cloud_shadows;
|
uniform bool use_cloud_shadows;
|
||||||
|
@ -116,7 +117,6 @@ void main()
|
||||||
color.a = diffuse_term.a;
|
color.a = diffuse_term.a;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This shouldn't be necessary, but our lighting becomes very
|
// This shouldn't be necessary, but our lighting becomes very
|
||||||
// saturated. Clamping the color before modulating by the texture
|
// saturated. Clamping the color before modulating by the texture
|
||||||
// is closer to what the OpenGL fixed function pipeline does.
|
// is closer to what the OpenGL fixed function pipeline does.
|
||||||
|
@ -141,18 +141,15 @@ void main()
|
||||||
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
||||||
|
|
||||||
|
|
||||||
float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ;
|
float fogLighting = clamp(NdotLfog,0.0,1.0) * length(diff_term.rgb/1.73);
|
||||||
//correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle));
|
|
||||||
float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle);
|
|
||||||
correction1 = 1.0;
|
|
||||||
|
|
||||||
//vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0);
|
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting;
|
||||||
|
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting;
|
||||||
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(smoothstep(0.4, 1.0,NdotLfog),0.0,1.0) * length(diff_term.rgb/1.73);
|
|
||||||
|
|
||||||
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
||||||
|
float rayleighFactor = exp(-distance_through_atmosphere/(300.0 / (1.0 + 4.0 * air_pollution)) );
|
||||||
|
|
||||||
|
fragColor.rgb = mix(rayleighColor, fragColor.rgb, rayleighFactor);
|
||||||
fragColor = mix(fogColor, fragColor, fogFactor);
|
fragColor = mix(fogColor, fragColor, fogFactor);
|
||||||
|
|
||||||
fragColor.rgb = filter_combined(fragColor.rgb);
|
fragColor.rgb = filter_combined(fragColor.rgb);
|
||||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
||||||
varying vec3 VTangent;
|
varying vec3 VTangent;
|
||||||
|
|
||||||
uniform float visibility;
|
uniform float visibility;
|
||||||
|
uniform float air_pollution;
|
||||||
uniform float sun_angle;
|
uniform float sun_angle;
|
||||||
uniform bool use_clouds;
|
uniform bool use_clouds;
|
||||||
uniform bool use_cloud_shadows;
|
uniform bool use_cloud_shadows;
|
||||||
|
@ -130,19 +131,17 @@ void main()
|
||||||
float angle = dot(normalize(ecViewDir), normalize(normal));
|
float angle = dot(normalize(ecViewDir), normalize(normal));
|
||||||
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
||||||
|
|
||||||
|
float fogLighting = clamp(NdotL,0.0,1.0) * length(diff_term.rgb/1.73);
|
||||||
|
|
||||||
float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ;
|
|
||||||
//correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle));
|
|
||||||
float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle);
|
|
||||||
correction1 = 1.0;
|
|
||||||
|
|
||||||
//vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0);
|
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting;
|
||||||
|
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting;
|
||||||
|
|
||||||
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(smoothstep(0.4, 1.0,NdotL),0.0,1.0) * length(diff_term.rgb/1.73);
|
|
||||||
|
|
||||||
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
||||||
|
float rayleighFactor = exp(-distance_through_atmosphere/(300.0 / (1.0 + 4.0 * air_pollution)) );
|
||||||
|
|
||||||
|
fragColor.rgb = mix(rayleighColor, fragColor.rgb, rayleighFactor);
|
||||||
fragColor = mix(fogColor, fragColor, fogFactor);
|
fragColor = mix(fogColor, fragColor, fogFactor);
|
||||||
|
|
||||||
fragColor.rgb = filter_combined(fragColor.rgb);
|
fragColor.rgb = filter_combined(fragColor.rgb);
|
||||||
|
|
|
@ -1369,6 +1369,9 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
<show-dummy type="bool" userarchive="n">false</show-dummy>
|
<show-dummy type="bool" userarchive="n">false</show-dummy>
|
||||||
<normal-flag type="bool" userarchive="y">false</normal-flag>
|
<normal-flag type="bool" userarchive="y">false</normal-flag>
|
||||||
<cloud-normal-flag type="bool" userarchive="y">false</cloud-normal-flag>
|
<cloud-normal-flag type="bool" userarchive="y">false</cloud-normal-flag>
|
||||||
|
<roi-x1 type="float" userarchive="n">0.0</roi-x1>
|
||||||
|
<roi-y1 type="float" userarchive="n">0.0</roi-y1>
|
||||||
|
<lightning type="float" userarchive="n">0.0</lightning>
|
||||||
</earthview>
|
</earthview>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
<!-- end of preferences.xml -->
|
<!-- end of preferences.xml -->
|
||||||
|
|
|
@ -396,6 +396,42 @@
|
||||||
<property>/environment/visibility-m</property>
|
<property>/environment/visibility-m</property>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<label> </label>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<halign>right</halign>
|
||||||
|
|
||||||
|
<!-- gap -->
|
||||||
|
<text>
|
||||||
|
<label> </label>
|
||||||
|
</text>
|
||||||
|
|
||||||
|
<text>
|
||||||
|
<label>Relative dust density</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<name>air_pollution</name>
|
||||||
|
<min>0.0</min>
|
||||||
|
<max>1.0</max>
|
||||||
|
<property>/environment/air-pollution-norm</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
<object-name>air_pollution</object-name>
|
||||||
|
</binding>
|
||||||
|
<live>true</live>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<label>12345678</label>
|
||||||
|
<format>%.1f</format>
|
||||||
|
<live>true</live>
|
||||||
|
<property>/environment/air-pollution-norm</property>
|
||||||
|
</text>
|
||||||
|
|
||||||
<!-- gap -->
|
<!-- gap -->
|
||||||
<text>
|
<text>
|
||||||
<label> </label>
|
<label> </label>
|
||||||
|
|
Loading…
Add table
Reference in a new issue