From 269a999c4d7f0b9fa3d479e1b66fa6776d0bdf24 Mon Sep 17 00:00:00 2001 From: "gral@who.net" Date: Sat, 28 Aug 2010 00:13:52 +0200 Subject: [PATCH 1/4] Adding season colour in forest/herbtundra/glacier effects --- Effects/forest.eff | 27 +++++++++++++++++++++++++++ Effects/glacier.eff | 27 +++++++++++++++++++++++++++ Effects/herbtundra.eff | 27 +++++++++++++++++++++++++++ Shaders/forest.frag | 17 ++++++++++------- 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/Effects/forest.eff b/Effects/forest.eff index 2ab35deb6..78bc67924 100644 --- a/Effects/forest.eff +++ b/Effects/forest.eff @@ -34,6 +34,13 @@ 0.04 15.0 /sim/rendering/quality-level + + + 0.12 + 0.86 + 0.0 + + 6 @@ -173,6 +180,26 @@ float quality-level + + red + float + season-red + + + green + float + season-green + + + blue + float + season-blue + + + alpha + float + 0.0 + diff --git a/Effects/glacier.eff b/Effects/glacier.eff index 641c37be0..c6e58025a 100644 --- a/Effects/glacier.eff +++ b/Effects/glacier.eff @@ -34,6 +34,13 @@ 0.01 15.0 /sim/rendering/quality-level + + + 0.12 + 0.86 + 0.0 + + 6 @@ -173,6 +180,26 @@ float quality-level + + red + float + season-red + + + green + float + season-green + + + blue + float + season-blue + + + alpha + float + 0.0 + diff --git a/Effects/herbtundra.eff b/Effects/herbtundra.eff index 0d30ff2fd..ece1a4817 100644 --- a/Effects/herbtundra.eff +++ b/Effects/herbtundra.eff @@ -33,6 +33,13 @@ /sim/rendering/snow-level-m 0.01 15.0 + + + 0.12 + 0.86 + 0.0 + + /sim/rendering/quality-level @@ -173,6 +180,26 @@ float quality-level + + red + float + season-red + + + green + float + season-green + + + blue + float + season-blue + + + alpha + float + 0.0 + diff --git a/Shaders/forest.frag b/Shaders/forest.frag index e54016026..0dc6c620e 100644 --- a/Shaders/forest.frag +++ b/Shaders/forest.frag @@ -15,6 +15,8 @@ uniform sampler2D SampleTex2; uniform sampler2D NormalTex; uniform float depth_factor; +uniform float red, green, blue, alpha; + uniform float quality_level; // From /sim/rendering/quality-level uniform float snowlevel; // From /sim/rendering/snow-level-m @@ -102,7 +104,7 @@ void main (void) fogFactor = exp2(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord * LOG2); float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2); - float n=0.02; + float n=0.06; n += nvL[0]*0.4; n += nvL[1]*0.6; n += nvL[2]*2.0; @@ -126,9 +128,10 @@ void main (void) //draw floor where !steep, and another blurb for smoothing transitions vec4 c3, c4, c5, c3a, c4a, c5a; - c3 = mix(vec4(n-0.88, n-0.14, -n, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); - c4 = mix(vec4(n-0.88, n-0.74, -n, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); - c4a = mix(vec4(n-0.76, n-0.66, -n, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); + float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue; + c3 = mix(vec4(n-subred, n-subgreen, -n, alpha), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); + c4 = mix(vec4(n-subred, n-subgreen-0.6, -n, alpha), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); + c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); c5 = mix(c3, c4, 1.0); c5a = mix(c3, c4a, 1.0); @@ -173,10 +176,10 @@ void main (void) diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); } - //should come as varying! - vec4 constantColor = vec4(1.0, 1.0, 1.0, 0.0); - vec4 ambient_light = gl_LightSource[0].diffuse * constantColor * vec4(diffuse, 1.0); + //vec4 constantColor = vec4(1.0, 1.0, 1.0, 0.0); + + vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0); c1 *= ambient_light; vec4 finalColor = c1; From 71a7c8cf72556eac37a88d289aa418f388897f36 Mon Sep 17 00:00:00 2001 From: "gral@who.net" Date: Sat, 28 Aug 2010 00:38:20 +0200 Subject: [PATCH 2/4] Removed different colorstrips, flickering between forest/herbtundra --- Effects/herbtundra.eff | 2 +- Shaders/forest.frag | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Effects/herbtundra.eff b/Effects/herbtundra.eff index ece1a4817..db4129177 100644 --- a/Effects/herbtundra.eff +++ b/Effects/herbtundra.eff @@ -11,7 +11,7 @@ normalized - Textures/Terrain/herbtundra-colors.png + Textures/Terrain/forest-colors.png linear-mipmap-linear mirror normalized diff --git a/Shaders/forest.frag b/Shaders/forest.frag index 0dc6c620e..de5a60a3d 100644 --- a/Shaders/forest.frag +++ b/Shaders/forest.frag @@ -187,5 +187,5 @@ void main (void) if(gl_Fog.density == 1.0) fogFactor=1.0; - gl_FragColor = mix(gl_Fog.color ,finalColor, fogFactor); + gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor); } From 7bf4dc5795ea323bd394af6d5590acaa116d0595 Mon Sep 17 00:00:00 2001 From: "gral@who.net" Date: Sat, 28 Aug 2010 00:54:06 +0200 Subject: [PATCH 3/4] Reactivate blue for forest.frag --- Effects/forest.eff | 2 +- Effects/glacier.eff | 2 +- Effects/herbtundra.eff | 2 +- Shaders/forest.frag | 9 +++------ 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Effects/forest.eff b/Effects/forest.eff index 78bc67924..e189b587a 100644 --- a/Effects/forest.eff +++ b/Effects/forest.eff @@ -38,7 +38,7 @@ 0.12 0.86 - 0.0 + 0.22 diff --git a/Effects/glacier.eff b/Effects/glacier.eff index c6e58025a..da9a06146 100644 --- a/Effects/glacier.eff +++ b/Effects/glacier.eff @@ -38,7 +38,7 @@ 0.12 0.86 - 0.0 + 0.22 diff --git a/Effects/herbtundra.eff b/Effects/herbtundra.eff index db4129177..5f97c2112 100644 --- a/Effects/herbtundra.eff +++ b/Effects/herbtundra.eff @@ -37,7 +37,7 @@ 0.12 0.86 - 0.0 + 0.22 /sim/rendering/quality-level diff --git a/Shaders/forest.frag b/Shaders/forest.frag index de5a60a3d..4641a8000 100644 --- a/Shaders/forest.frag +++ b/Shaders/forest.frag @@ -129,9 +129,9 @@ void main (void) //draw floor where !steep, and another blurb for smoothing transitions vec4 c3, c4, c5, c3a, c4a, c5a; float subred = 1.0 - red; float subgreen = 1.0 - green; float subblue = 1.0 - blue; - c3 = mix(vec4(n-subred, n-subgreen, -n, alpha), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); - c4 = mix(vec4(n-subred, n-subgreen-0.6, -n, alpha), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); - c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); + c3 = mix(vec4(n-subred, n-subgreen, -n-subblue, 0.0), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.3)); + c4 = mix(vec4(n-subred, n-subgreen-0.6, -n-subblue, 0.0), c1, smoothstep(0.990, 0.890, abs(normalize(Normal).z)+nvL[2]*0.9)); + c4a = mix(vec4(n-subred+0.12, n-subgreen-0.52, -n-subblue, 0.3), c1, smoothstep(0.990, 0.970, abs(normalize(Normal).z)+nvL[2]*1.32)); c5 = mix(c3, c4, 1.0); c5a = mix(c3, c4a, 1.0); @@ -175,9 +175,6 @@ void main (void) c1 = mix(c1, c5, clamp(0.65, n*0.5, 0.6)); diffuse = gl_Color.rgb * max(0.8, dot(N, l)) * max(0.9, dot(VNormal, gl_LightSource[0].position.xyz)); } - - - //vec4 constantColor = vec4(1.0, 1.0, 1.0, 0.0); vec4 ambient_light = gl_LightSource[0].diffuse * vec4(diffuse, 0.0); From 45dd7055e5663695dc9dc7d860b1ef41c177a61a Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Sat, 28 Aug 2010 20:31:44 +0200 Subject: [PATCH 4/4] Implementation of weather interpolation using property-rules --- Environment/clouds-altitude-interpolate.xml | 41 +++ Environment/clouds-altitude-set.xml | 43 +++ Environment/clouds-coverage.xml | 37 ++ Environment/clouds-thickness.xml | 29 ++ Environment/environment.xml | 12 +- Environment/interpolator.xml | 111 ++++++ Environment/layer-heading-offset.xml | 36 ++ Environment/layer-speed-change.xml | 39 ++ Environment/metarinterpolator.xml | 375 ++++++++++++++++++++ 9 files changed, 718 insertions(+), 5 deletions(-) create mode 100644 Environment/clouds-altitude-interpolate.xml create mode 100644 Environment/clouds-altitude-set.xml create mode 100644 Environment/clouds-coverage.xml create mode 100644 Environment/clouds-thickness.xml create mode 100644 Environment/interpolator.xml create mode 100644 Environment/layer-heading-offset.xml create mode 100644 Environment/layer-speed-change.xml create mode 100644 Environment/metarinterpolator.xml diff --git a/Environment/clouds-altitude-interpolate.xml b/Environment/clouds-altitude-interpolate.xml new file mode 100644 index 000000000..1bcd1b1fe --- /dev/null +++ b/Environment/clouds-altitude-interpolate.xml @@ -0,0 +1,41 @@ + + + + + environment/metar/clouds/layer[0]/elevation-ft + /environment/clouds/layer[0]/elevation-ft + + MetarController:clouds:altitude_interpolate + noise-spike + 8.333 + + + /environment/metar/valid + + + -9000 + + + + -9000 + + + + + + diff --git a/Environment/clouds-altitude-set.xml b/Environment/clouds-altitude-set.xml new file mode 100644 index 000000000..edd834a49 --- /dev/null +++ b/Environment/clouds-altitude-set.xml @@ -0,0 +1,43 @@ + + + + + environment/metar/clouds/layer[0]/elevation-ft + /environment/clouds/layer[0]/elevation-ft + + MetarController:clouds:altitude_set + gain + 1.0 + + + /environment/metar/valid + + + + -9000 + + + + -9000 + + + + + + + diff --git a/Environment/clouds-coverage.xml b/Environment/clouds-coverage.xml new file mode 100644 index 000000000..83e2fdbbe --- /dev/null +++ b/Environment/clouds-coverage.xml @@ -0,0 +1,37 @@ + + + + + /environment/metar/clouds/layer[0]/coverage-type + environment/clouds/layer[0]/coverage-type + + MetarController:clouds:coverage + gain + 1.0 + + + /environment/metar/valid + + + + + + + + + diff --git a/Environment/clouds-thickness.xml b/Environment/clouds-thickness.xml new file mode 100644 index 000000000..89e64573a --- /dev/null +++ b/Environment/clouds-thickness.xml @@ -0,0 +1,29 @@ + + + + MetarController:clouds:thickness + + + /environment/metar/valid + + + /environment/metar/clouds/layer[0]/thickness-ft + /environment/clouds/layer[0]/thickness-ft + noise-spike + 8.3333 + diff --git a/Environment/environment.xml b/Environment/environment.xml index d20eda081..71e44e61e 100644 --- a/Environment/environment.xml +++ b/Environment/environment.xml @@ -43,7 +43,7 @@ Stormy Monday - XXXX 012345Z 28035G50KT 9999 TSRA SCT022CB BKN030 13/09 Q1005 + XXXX 012345Z 28035G50KT 250V300 9999 TSRA SCT022CB BKN030 13/09 Q1005 You're out for an adventure? Gusty winds blowing from the west and isolated thunderstorms should be avoided. Fasten your seatbelt! @@ -169,31 +169,33 @@ - true clear - 4000 + -9999 600 150 40000 clear - 19500 + -9999 65 25 40000 clear + -9999 40000 clear + -9999 40000 - + clear + -9999 40000 diff --git a/Environment/interpolator.xml b/Environment/interpolator.xml new file mode 100644 index 000000000..761bb608c --- /dev/null +++ b/Environment/interpolator.xml @@ -0,0 +1,111 @@ + + + + + + + EnvironmentInterpolator:temperature-sea-level-degc + + + /environment/config/enabled + + + /environment/config/interpolated/temperature-sea-level-degc + /environment/temperature-sea-level-degc + noise-spike + 0.1667 + + + + EnvironmentInterpolator:dewpoint-sea-level-degc + + + /environment/config/enabled + + + /environment/config/interpolated/dewpoint-sea-level-degc + /environment/dewpoint-sea-level-degc + noise-spike + 0.1667 + + + + + EnvironmentInterpolator:pressure-sea-level-inhg + noise-spike + 0.03 + + + /environment/config/enabled + + + /environment/config/interpolated/pressure-sea-level-inhg + /environment/pressure-sea-level-inhg + + + + EnvironmentInterpolator:visibility-m + + + /environment/config/enabled + + + /environment/config/interpolated/visibility-m + /environment/visibility-m + exponential + 10 + + + + + EnvironmentInterpolator:wind-from-north + + + /environment/config/enabled + + + /environment/config/interpolated/wind-from-north-fps + /environment/wind-from-north-fps + exponential + 5 + + + + EnvironmentInterpolator:wind-from-east + + + /environment/config/enabled + + + /environment/config/interpolated/wind-from-east-fps + /environment/wind-from-east-fps + exponential + 5 + + + diff --git a/Environment/layer-heading-offset.xml b/Environment/layer-heading-offset.xml new file mode 100644 index 000000000..363f71560 --- /dev/null +++ b/Environment/layer-heading-offset.xml @@ -0,0 +1,36 @@ + + + + MetarController:layer:wind-from-heading-deg + gain + 1.0 + + + /environment/metar/valid + + + + /environment/config/boundary/entry[0]/wind-from-heading-deg + /environment/config/boundary/entry[1]/wind-heading-change-deg + + /environment/config/boundary/entry[1]/wind-from-heading-deg + + 0 + 360 + + diff --git a/Environment/layer-speed-change.xml b/Environment/layer-speed-change.xml new file mode 100644 index 000000000..6cce732f4 --- /dev/null +++ b/Environment/layer-speed-change.xml @@ -0,0 +1,39 @@ + + + + MetarController:layer:wind-speed-kt + gain + 1.0 + + + /environment/metar/valid + + + + + + /environment/config/boundary/entry[0]/wind-speed-kt + + /environment/config/boundary/entry[1]/wind-speed-change-rel + 1.0 + + + + + /environment/config/boundary/entry[1]/wind-speed-kt + diff --git a/Environment/metarinterpolator.xml b/Environment/metarinterpolator.xml new file mode 100644 index 000000000..35775635f --- /dev/null +++ b/Environment/metarinterpolator.xml @@ -0,0 +1,375 @@ + + + + + + + MetarController:pressure-sea-level-inhg + noise-spike + 0.0003 + + + /environment/metar/valid + + + /environment/metar/pressure-sea-level-inhg + /environment/config/boundary/entry/pressure-sea-level-inhg + /environment/config/aloft/entry/pressure-sea-level-inhg + + + + + MetarController:temperature-sea-level-degc + noise-spike + 0.01667 + + + /environment/metar/valid + + + /environment/metar/temperature-sea-level-degc + /environment/config/boundary/entry[0]/temperature-sea-level-degc + /environment/config/boundary/entry[1]/temperature-sea-level-degc + /environment/config/aloft/entry[0]/temperature-sea-level-degc + /environment/config/aloft/entry[1]/temperature-sea-level-degc + /environment/config/aloft/entry[2]/temperature-sea-level-degc + /environment/config/aloft/entry[3]/temperature-sea-level-degc + /environment/config/aloft/entry[4]/temperature-sea-level-degc + + + + + MetarController:dewpoint-sea-level-degc + noise-spike + 0.01667 + + + /environment/metar/valid + + + /environment/metar/dewpoint-sea-level-degc + /environment/config/boundary/entry[0]/dewpoint-sea-level-degc + /environment/config/boundary/entry[1]/dewpoint-sea-level-degc + /environment/config/aloft/entry[0]/dewpoint-sea-level-degc + /environment/config/aloft/entry[1]/dewpoint-sea-level-degc + /environment/config/aloft/entry[2]/dewpoint-sea-level-degc + /environment/config/aloft/entry[3]/dewpoint-sea-level-degc + /environment/config/aloft/entry[4]/dewpoint-sea-level-degc + + + + + MetarController:visibility-m + exponential + 30 + + + /environment/metar/valid + + + /environment/metar/min-visibility-m + /environment/config/boundary/entry[0]/visibility-m + /environment/config/boundary/entry[1]/visibility-m + /environment/config/aloft/entry[0]/visibility-m + /environment/config/aloft/entry[1]/visibility-m + + + + + + MetarController:wind-from-north-kt + exponential + 30 + + + /environment/metar/valid + + + + + + + /environment/metar/base-wind-dir-deg + 0.0174533 + + + + /environment/metar/base-wind-speed-kt + + /environment/metar/base-wind-from-north-kt + + + + MetarController:wind-from-east-kt + exponential + 30 + + + /environment/metar/valid + + + + + + + /environment/metar/base-wind-dir-deg + 0.0174533 + + + + /environment/metar/base-wind-speed-kt + + /environment/metar/base-wind-from-east-kt + + + + MetarController::wind-speed-kt + + + /environment/metar/valid + + + + + + + + + /environment/metar/base-wind-from-east-kt + /environment/metar/base-wind-from-east-kt + + + /environment/metar/base-wind-from-north-kt + /environment/metar/base-wind-from-north-kt + + + + + + /environment/config/boundary/entry[0]/wind-speed-kt + gain + 1.0 + + + + MetarController:wind-from-heading-deg + + + /environment/metar/valid + + + + + + /environment/metar/base-wind-from-east-kt + /environment/metar/base-wind-from-north-kt + + + + /environment/config/boundary/entry[0]/wind-from-heading-deg + gain + 57.3 + + 0 + 360 + + + + + + + + + /environment/config/aloft/entry[0]/wind-heading-change-deg + + /environment/config/aloft/entry[0]/wind-from-heading-deg + + + + /environment/config/aloft/entry[1]/wind-heading-change-deg + + /environment/config/aloft/entry[1]/wind-from-heading-deg + + + + /environment/config/aloft/entry[2]/wind-heading-change-deg + + /environment/config/aloft/entry[2]/wind-from-heading-deg + + + + /environment/config/aloft/entry[3]/wind-heading-change-deg + + /environment/config/aloft/entry[3]/wind-from-heading-deg + + + + /environment/config/aloft/entry[4]/wind-heading-change-deg + + /environment/config/aloft/entry[4]/wind-from-heading-deg + + + + + + /environment/config/aloft/entry[0]/wind-speed-change-rel + + /environment/config/aloft/entry[0]/wind-speed-kt + + + + /environment/config/aloft/entry[1]/wind-speed-change-rel + + /environment/config/aloft/entry[1]/wind-speed-kt + + + + /environment/config/aloft/entry[2]/wind-speed-change-rel + + /environment/config/aloft/entry[2]/wind-speed-kt + + + + /environment/config/aloft/entry[3]/wind-speed-change-rel + + /environment/config/aloft/entry[3]/wind-speed-kt + + + + /environment/config/aloft/entry[4]/wind-speed-change-rel + + /environment/config/aloft/entry[4]/wind-speed-kt + + + + + + + + /environment/metar/clouds/layer[1]/elevation-ft + /environment/clouds/layer[1]/elevation-ft + + + + + /environment/metar/clouds/layer[2]/elevation-ft + /environment/clouds/layer[2]/elevation-ft + + + + + /environment/metar/clouds/layer[3]/elevation-ft + /environment/clouds/layer[3]/elevation-ft + + + + + /environment/metar/clouds/layer[4]/elevation-ft + /environment/clouds/layer[4]/elevation-ft + + + + + + + /environment/metar/clouds/layer[1]/elevation-ft + /environment/clouds/layer[1]/elevation-ft + + + + + /environment/metar/clouds/layer[2]/elevation-ft + /environment/clouds/layer[2]/elevation-ft + + + + + /environment/metar/clouds/layer[3]/elevation-ft + /environment/clouds/layer[3]/elevation-ft + + + + + /environment/metar/clouds/layer[4]/elevation-ft + /environment/clouds/layer[4]/elevation-ft + + + + + + /environment/metar/clouds/layer[1]/thickness-ft + /environment/clouds/layer[1]/thickness-ft + + + /environment/metar/clouds/layer[2]/thickness-ft + /environment/clouds/layer[2]/thickness-ft + + + /environment/metar/clouds/layer[3]/thickness-ft + /environment/clouds/layer[3]/thickness-ft + + + /environment/metar/clouds/layer[4]/thickness-ft + /environment/clouds/layer[4]/thickness-ft + + + + + + /environment/metar/clouds/layer[1]/coverage-type + environment/clouds/layer[1]/coverage-type + + + + + /environment/metar/clouds/layer[2]/coverage-type + environment/clouds/layer[2]/coverage-type + + + + + /environment/metar/clouds/layer[3]/coverage-type + environment/clouds/layer[3]/coverage-type + + + + + /environment/metar/clouds/layer[4]/coverage-type + environment/clouds/layer[4]/coverage-type + + +