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
|
@ -17,15 +17,16 @@
|
|||
<patchiness><use>/environment/aurora/patchiness</use></patchiness>
|
||||
<afterglow><use>/environment/aurora/afterglow</use></afterglow>
|
||||
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
<arc_id>0.0</arc_id>
|
||||
</parameters>
|
||||
|
||||
|
||||
|
@ -77,9 +78,9 @@
|
|||
<shade-model>
|
||||
<use>shade-model</use>
|
||||
</shade-model>
|
||||
<cull-face>
|
||||
<!--<cull-face>
|
||||
<use>cull-face</use>
|
||||
</cull-face>
|
||||
</cull-face>-->
|
||||
<rendering-hint>
|
||||
<use>rendering-hint</use>
|
||||
</rendering-hint>
|
||||
|
@ -87,7 +88,7 @@
|
|||
<write-mask>false</write-mask>
|
||||
</depth>
|
||||
<render-bin>
|
||||
<bin-number>10</bin-number>
|
||||
<bin-number>111</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
|
@ -164,6 +165,11 @@
|
|||
<type>float</type>
|
||||
<value><use>brightness</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>arc_id</name>
|
||||
<type>float</type>
|
||||
<value><use>arc_id</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>use_filtering</name>
|
||||
<type>bool</type>
|
||||
|
|
|
@ -23,17 +23,21 @@
|
|||
<use-cloud-normals><use>/earthview/cloud-normal-flag</use></use-cloud-normals>
|
||||
<shade-effect><use>/earthview/shade-effect</use></shade-effect>
|
||||
<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>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
|
||||
</parameters>
|
||||
<generate>
|
||||
<normal type="int">15</normal>
|
||||
|
@ -161,7 +165,7 @@
|
|||
<value>
|
||||
<use>use-cloud-normals</use>
|
||||
</value>
|
||||
</uniform>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>colorMode</name>
|
||||
<type>int</type>
|
||||
|
@ -183,11 +187,11 @@
|
|||
<use>shade-effect</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>sun_angle</name>
|
||||
<type>float</type>
|
||||
|
@ -195,6 +199,27 @@
|
|||
<use>sun-angle</use>
|
||||
</value>
|
||||
</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>
|
||||
<name>gamma</name>
|
||||
<type>float</type>
|
||||
|
|
|
@ -35,20 +35,21 @@
|
|||
<!-- DIFFUSE -->
|
||||
</material>
|
||||
<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-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
|
||||
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
||||
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
|
||||
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
|
||||
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
|
||||
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
|
||||
<fact_grey><use>/sim/rendering/als-filters/grey-factor</use></fact_grey>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
<fact_black><use>/sim/rendering/als-filters/black-factor</use></fact_black>
|
||||
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_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_ysize><use>/sim/startup/ysize</use></display_ysize>
|
||||
</parameters>
|
||||
<generate>
|
||||
<normal type="int">15</normal>
|
||||
|
@ -196,6 +197,13 @@
|
|||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>air_pollution</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>sun_angle</name>
|
||||
<type>float</type>
|
||||
|
@ -412,6 +420,13 @@
|
|||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>air_pollution</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>sun_angle</name>
|
||||
<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"?>
|
||||
|
||||
<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>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<PropertyList>
|
||||
<model>
|
||||
<path>aurora_inner.xml</path>
|
||||
</model>
|
||||
<model>
|
||||
<path>aurora_outer.xml</path>
|
||||
</model>
|
||||
|
||||
</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>
|
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,39 @@
|
|||
# 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() {
|
||||
|
||||
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/rayleigh", 0.00002);
|
||||
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.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();
|
||||
|
||||
slow_loop();
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
var adjust_cloud_tiles = func {
|
||||
|
@ -370,7 +470,7 @@ if (action)
|
|||
{
|
||||
var lat = getprop("/position/latitude-deg");
|
||||
var lon = getprop("/position/longitude-deg");
|
||||
|
||||
|
||||
if (i==1)
|
||||
{
|
||||
earth_model.node1 = place_earth_model("Models/Astro/earth_N1.xml",lat, lon, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
|
@ -14,6 +14,7 @@ uniform float upper_alt_factor;
|
|||
uniform float penetration_factor;
|
||||
uniform float patchiness;
|
||||
uniform float afterglow;
|
||||
uniform float arc_id;
|
||||
uniform float osg_SimulationTime;
|
||||
|
||||
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 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 relVec;
|
||||
|
||||
uniform float osg_SimulationTime;
|
||||
uniform float arc_id;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
|
@ -11,5 +15,14 @@ void main()
|
|||
vertex = gl_Vertex.xyz;
|
||||
vec3 ep = (gl_ModelViewMatrixInverse * vec4 (0.0, 0.0, 0.0, 1.0)).xyz;
|
||||
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 air_pollution;
|
||||
|
||||
uniform float roi_x1;
|
||||
uniform float roi_y1;
|
||||
uniform float lightning;
|
||||
|
||||
uniform bool use_overlay;
|
||||
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()
|
||||
{
|
||||
|
@ -71,27 +86,46 @@ void main()
|
|||
vec3 binormal = cross(n, tangent);
|
||||
float NdotL2 = 0.0;
|
||||
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
ref_texel = texel;
|
||||
|
||||
if (use_cloud_normals)
|
||||
{
|
||||
vec2 sun2d = vec2 (0.0, 1.0);
|
||||
vec2 sun2d = vec2 (0.0, 1.0);
|
||||
|
||||
float xOffset = -1.0 * dot(normalize(lightDir), tangent);
|
||||
float yOffset = -1.0 * dot(normalize(lightDir), binormal);
|
||||
float xOffset = -1.0 * dot(normalize(lightDir), tangent);
|
||||
float yOffset = -1.0 * dot(normalize(lightDir), binormal);
|
||||
|
||||
grad_dir = normalize (vec2 (xOffset, yOffset));
|
||||
|
||||
vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir);
|
||||
|
||||
// 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;
|
||||
if (slope < 0.0) {sign = 1.0;}
|
||||
|
||||
vec2 snormal = normalize(vec2 (slope, 1.0));
|
||||
|
||||
NdotL2 = dot (snormal, sun2d);
|
||||
NdotL = add_cosines(NdotL, NdotL2, sign );
|
||||
|
||||
|
||||
grad_dir = normalize (vec2 (xOffset, yOffset));
|
||||
|
||||
vec4 comp_texel = texture2D(texture, gl_TexCoord[0].st - 0.0005 * grad_dir);
|
||||
|
||||
float slope = shade_effect * (comp_texel.a - ref_texel.a);
|
||||
float sign = -1.0;
|
||||
if (slope < 0.0) {sign = 1.0;}
|
||||
|
||||
vec2 snormal = normalize(vec2 (slope, 1.0));
|
||||
|
||||
NdotL2 = dot (snormal, sun2d);
|
||||
NdotL = add_cosines(NdotL, NdotL2, sign );
|
||||
|
||||
}
|
||||
|
||||
|
||||
color += diff_term * max(NdotL, 0.15) ;
|
||||
|
||||
|
||||
|
@ -101,15 +135,13 @@ void main()
|
|||
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);
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
|
||||
|
||||
|
||||
ref_texel = texel;
|
||||
|
||||
structureTexel = texture2D(structure_texture, 20.0 * gl_TexCoord[0].st);
|
||||
|
||||
float noise = Noise2D( gl_TexCoord[0].st, 0.01);
|
||||
|
@ -127,6 +159,9 @@ void main()
|
|||
{
|
||||
texel = vec4(structureTexel.rgb, smoothstep(0.0, 0.5,texel.a) * structureTexel.a);
|
||||
}
|
||||
|
||||
|
||||
texel.a = clamp((1.0 + darkness_fact) * texel.a, 0.0, 1.0);
|
||||
|
||||
|
||||
fragColor = color * texel;
|
||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
|||
varying vec3 VTangent;
|
||||
|
||||
uniform float visibility;
|
||||
uniform float air_pollution;
|
||||
uniform float sun_angle;
|
||||
uniform bool use_clouds;
|
||||
uniform bool use_cloud_shadows;
|
||||
|
@ -75,9 +76,9 @@ void main()
|
|||
NdotL = dot(N, lightDir);
|
||||
float NdotLraw = NdotL;
|
||||
// due to atmosphere scattering, we should make this harder
|
||||
NdotL = smoothstep(-0.2,0.2,NdotL);
|
||||
NdotL = smoothstep(-0.2 ,0.2,NdotL);
|
||||
// fog does not feel normal map
|
||||
float NdotLfog = smoothstep(-0.2, 0.2, dot(n, lightDir));
|
||||
float NdotLfog = smoothstep(-0.2 , 0.2, dot(n, lightDir));
|
||||
|
||||
float intensity = length(diffuse_term);
|
||||
vec4 dawn = intensity * normalize (vec4 (1.0,0.5,0.3,1.0));
|
||||
|
@ -116,7 +117,6 @@ void main()
|
|||
color.a = diffuse_term.a;
|
||||
|
||||
|
||||
|
||||
// This shouldn't be necessary, but our lighting becomes very
|
||||
// saturated. Clamping the color before modulating by the texture
|
||||
// is closer to what the OpenGL fixed function pipeline does.
|
||||
|
@ -140,19 +140,16 @@ void main()
|
|||
float angle = dot(normalize(ecViewDir), normalize(normal));
|
||||
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 ) ;
|
||||
//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) * clamp(smoothstep(0.4, 1.0,NdotLfog),0.0,1.0) * length(diff_term.rgb/1.73);
|
||||
|
||||
|
||||
float fogLighting = clamp(NdotLfog,0.0,1.0) * length(diff_term.rgb/1.73);
|
||||
|
||||
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting;
|
||||
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting;
|
||||
|
||||
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.rgb = filter_combined(fragColor.rgb);
|
||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
|||
varying vec3 VTangent;
|
||||
|
||||
uniform float visibility;
|
||||
uniform float air_pollution;
|
||||
uniform float sun_angle;
|
||||
uniform bool use_clouds;
|
||||
uniform bool use_cloud_shadows;
|
||||
|
@ -130,19 +131,17 @@ void main()
|
|||
float angle = dot(normalize(ecViewDir), normalize(normal));
|
||||
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) * clamp(smoothstep(0.4, 1.0,NdotL),0.0,1.0) * length(diff_term.rgb/1.73);
|
||||
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * fogLighting;
|
||||
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * fogLighting;
|
||||
|
||||
|
||||
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.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>
|
||||
<normal-flag type="bool" userarchive="y">false</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>
|
||||
</PropertyList>
|
||||
<!-- end of preferences.xml -->
|
||||
|
|
|
@ -395,6 +395,42 @@
|
|||
<live>true</live>
|
||||
<property>/environment/visibility-m</property>
|
||||
</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 -->
|
||||
<text>
|
||||
|
|
Loading…
Reference in a new issue