From f3d79f18e33c2bbb0c51f58b245b8cc0932517f7 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Fri, 8 Apr 2016 15:57:59 +0300 Subject: [PATCH] Rain layer effect to ALS filtering --- Effects/rain-layer.eff | 50 +++++++++++++++++++++++++++++++++++++ Shaders/rain-layer-ALS.frag | 15 ++++++++--- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/Effects/rain-layer.eff b/Effects/rain-layer.eff index 130c0742f..cef0f27ed 100644 --- a/Effects/rain-layer.eff +++ b/Effects/rain-layer.eff @@ -12,6 +12,14 @@ /environment/lightning/lightning-pos-y /environment/lightning/lightning-range 0 + /sim/rendering/als-filters/use-filtering + /sim/rendering/als-filters/gamma + /sim/rendering/als-filters/brightness + /environment/surface/delta-T-cloud + /sim/rendering/als-filters/use-night-vision + /sim/rendering/als-filters/use-IR-vision + /sim/startup/xsize + /sim/startup/ysize @@ -61,6 +69,8 @@ Shaders/rain-layer-ALS.vert Shaders/rain-layer-ALS.frag + Shaders/filters-ALS.frag + Shaders/noise.frag baseTexture @@ -107,6 +117,46 @@ bool is-lightning + + gamma + float + gamma + + + brightness + float + brightness + + + use_filtering + bool + use_filtering + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + delta_T + float + delta_T + + + display_xsize + int + display_xsize + + + display_ysize + int + display_ysize + diff --git a/Shaders/rain-layer-ALS.frag b/Shaders/rain-layer-ALS.frag index 8e5e506db..1b8c7198c 100644 --- a/Shaders/rain-layer-ALS.frag +++ b/Shaders/rain-layer-ALS.frag @@ -3,6 +3,8 @@ varying float fogFactor; varying vec3 hazeColor; varying vec3 relVector; +vec3 filter_combined (in vec3 color) ; + uniform bool is_lightning; vec3 rainbow (in float index) @@ -31,7 +33,7 @@ void main(void) vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); vec4 finalColor = base * gl_Color; - + vec4 fragColor; if (is_lightning==false) @@ -49,9 +51,14 @@ void main(void) finalColor.rgb = mix(finalColor.rgb, rainbow_color, 0.5* rainbow_shape); - gl_FragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor ); + fragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor ); } else - {gl_FragColor.rgb = finalColor;} - gl_FragColor.a = mix(0.0, finalColor.a, fogFactor); + {fragColor.rgb = finalColor;} + fragColor.a = mix(0.0, finalColor.a, fogFactor); + + fragColor.rgb = filter_combined(fragColor.rgb); + + gl_FragColor = fragColor; + }