From fbc81836c0ba849c05904c6cb174ee241c2aeb36 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Fri, 25 Mar 2016 10:49:07 +0200 Subject: [PATCH] Add urban and agriculture effects to ALS filtering scheme --- Effects/agriculture.eff | 32 ++++++++++++++ Effects/urban.eff | 86 +++++++++++++++++++++++++++++++----- Shaders/agriculture-ALS.frag | 3 +- Shaders/urban-ALS.frag | 6 ++- Shaders/urban-ALS.vert | 8 ++++ 5 files changed, 122 insertions(+), 13 deletions(-) diff --git a/Effects/agriculture.eff b/Effects/agriculture.eff index 7d8d6e1fd..041f920ea 100644 --- a/Effects/agriculture.eff +++ b/Effects/agriculture.eff @@ -244,6 +244,7 @@ Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag + Shaders/filters-ALS.frag grain_strength @@ -424,6 +425,37 @@ landing_light3_offset float landing_light3_offset + + + + gamma + float + gamma + + + brightness + float + brightness + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + use_filtering + bool + use_filtering + + + delta_T + float + delta_T cloudpos1_x diff --git a/Effects/urban.eff b/Effects/urban.eff index 611291f13..6e5c60347 100644 --- a/Effects/urban.eff +++ b/Effects/urban.eff @@ -178,6 +178,7 @@ Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag + Shaders/filters-ALS.frag tangent 6 @@ -386,11 +387,43 @@ float landing_light2_offset - - landing_light3_offset - float - landing_light3_offset - + + landing_light3_offset + float + landing_light3_offset + + + + gamma + float + gamma + + + brightness + float + brightness + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + use_filtering + bool + use_filtering + + + delta_T + float + delta_T + + cloudpos1_x float @@ -736,6 +769,7 @@ Shaders/noise.frag Shaders/hazes.frag Shaders/secondary_lights.frag + Shaders/filters-ALS.frag tangent 6 @@ -856,11 +890,43 @@ float landing_light2_offset - - landing_light3_offset - float - landing_light3_offset - + + landing_light3_offset + float + landing_light3_offset + + + + gamma + float + gamma + + + brightness + float + brightness + + + use_night_vision + bool + use_night_vision + + + use_IR_vision + bool + use_IR_vision + + + use_filtering + bool + use_filtering + + + delta_T + float + delta_T + + cloudpos1_x float diff --git a/Shaders/agriculture-ALS.frag b/Shaders/agriculture-ALS.frag index 14cfe8259..1a12c6f16 100644 --- a/Shaders/agriculture-ALS.frag +++ b/Shaders/agriculture-ALS.frag @@ -89,7 +89,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter); vec3 get_hazeColor(in float light_arg); vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); - +vec3 filter_combined (in vec3 color) ; // a fade function for procedural scales which are smaller than a pixel @@ -650,6 +650,7 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility), } +fragColor.rgb = filter_combined(fragColor.rgb); gl_FragColor = fragColor; diff --git a/Shaders/urban-ALS.frag b/Shaders/urban-ALS.frag index c796621a3..3a874d692 100644 --- a/Shaders/urban-ALS.frag +++ b/Shaders/urban-ALS.frag @@ -84,7 +84,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter); vec3 get_hazeColor(in float light_arg); vec3 searchlight(); vec3 landing_light(in float offset, in float offsetv); - +vec3 filter_combined (in vec3 color) ; void QDM(inout vec3 p, inout vec3 v) { @@ -524,7 +524,7 @@ finalColor.rgb = mix( hazeColor +secondary_light * fog_backscatter(mvisibility), } - +finalColor.rgb = filter_combined(finalColor.rgb); gl_FragColor = finalColor; @@ -535,4 +535,6 @@ gl_FragColor = finalColor; } else { gl_FragDepth = gl_FragCoord.z; } + + } diff --git a/Shaders/urban-ALS.vert b/Shaders/urban-ALS.vert index 8e553a4b5..9eac7739c 100644 --- a/Shaders/urban-ALS.vert +++ b/Shaders/urban-ALS.vert @@ -44,6 +44,8 @@ uniform float ground_scattering; uniform float eye_alt; uniform float moonlight; +uniform bool use_IR_vision; + uniform mat4 osg_ViewMatrixInverse; attribute vec3 tangent;//, binormal; @@ -268,6 +270,12 @@ float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smooth light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth); light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth); +if (use_IR_vision) + { + light_ambient.rgb = max(light_ambient.rgb, vec3 (0.5, 0.5, 0.5)); + } + + // default lighting based on texture and material using the light we have just computed gl_FrontColor = gl_Color;