Add urban and agriculture effects to ALS filtering scheme
This commit is contained in:
parent
b7e543960b
commit
fbc81836c0
5 changed files with 122 additions and 13 deletions
|
@ -244,6 +244,7 @@
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
||||||
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
</program>
|
</program>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>grain_strength</name>
|
<name>grain_strength</name>
|
||||||
|
@ -424,6 +425,37 @@
|
||||||
<name>landing_light3_offset</name>
|
<name>landing_light3_offset</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>landing_light3_offset</use></value>
|
<value><use>landing_light3_offset</use></value>
|
||||||
|
</uniform>
|
||||||
|
<!-- filtering -->
|
||||||
|
<uniform>
|
||||||
|
<name>gamma</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>gamma</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>brightness</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>brightness</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_night_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_night_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_IR_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_IR_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_filtering</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_filtering</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>delta_T</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>delta_T</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>cloudpos1_x</name>
|
<name>cloudpos1_x</name>
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
||||||
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
@ -386,11 +387,43 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>landing_light2_offset</use></value>
|
<value><use>landing_light2_offset</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>landing_light3_offset</name>
|
<name>landing_light3_offset</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>landing_light3_offset</use></value>
|
<value><use>landing_light3_offset</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<!-- filtering -->
|
||||||
|
<uniform>
|
||||||
|
<name>gamma</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>gamma</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>brightness</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>brightness</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_night_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_night_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_IR_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_IR_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_filtering</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_filtering</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>delta_T</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>delta_T</use></value>
|
||||||
|
</uniform>
|
||||||
|
<!-- cloud shadows -->
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>cloudpos1_x</name>
|
<name>cloudpos1_x</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
@ -736,6 +769,7 @@
|
||||||
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
<fragment-shader>Shaders/noise.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
<fragment-shader>Shaders/hazes.frag</fragment-shader>
|
||||||
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
|
||||||
|
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
|
||||||
<attribute>
|
<attribute>
|
||||||
<name>tangent</name>
|
<name>tangent</name>
|
||||||
<index>6</index>
|
<index>6</index>
|
||||||
|
@ -856,11 +890,43 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>landing_light2_offset</use></value>
|
<value><use>landing_light2_offset</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>landing_light3_offset</name>
|
<name>landing_light3_offset</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>landing_light3_offset</use></value>
|
<value><use>landing_light3_offset</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<!-- filtering -->
|
||||||
|
<uniform>
|
||||||
|
<name>gamma</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>gamma</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>brightness</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>brightness</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_night_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_night_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_IR_vision</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_IR_vision</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>use_filtering</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value><use>use_filtering</use></value>
|
||||||
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>delta_T</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>delta_T</use></value>
|
||||||
|
</uniform>
|
||||||
|
<!-- cloud shadows -->
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>cloudpos1_x</name>
|
<name>cloudpos1_x</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
|
|
@ -89,7 +89,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
|
||||||
vec3 get_hazeColor(in float light_arg);
|
vec3 get_hazeColor(in float light_arg);
|
||||||
vec3 searchlight();
|
vec3 searchlight();
|
||||||
vec3 landing_light(in float offset, in float offsetv);
|
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
|
// 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;
|
gl_FragColor = fragColor;
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
|
||||||
vec3 get_hazeColor(in float light_arg);
|
vec3 get_hazeColor(in float light_arg);
|
||||||
vec3 searchlight();
|
vec3 searchlight();
|
||||||
vec3 landing_light(in float offset, in float offsetv);
|
vec3 landing_light(in float offset, in float offsetv);
|
||||||
|
vec3 filter_combined (in vec3 color) ;
|
||||||
|
|
||||||
void QDM(inout vec3 p, inout vec3 v)
|
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;
|
gl_FragColor = finalColor;
|
||||||
|
|
||||||
|
@ -535,4 +535,6 @@ gl_FragColor = finalColor;
|
||||||
} else {
|
} else {
|
||||||
gl_FragDepth = gl_FragCoord.z;
|
gl_FragDepth = gl_FragCoord.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,8 @@ uniform float ground_scattering;
|
||||||
uniform float eye_alt;
|
uniform float eye_alt;
|
||||||
uniform float moonlight;
|
uniform float moonlight;
|
||||||
|
|
||||||
|
uniform bool use_IR_vision;
|
||||||
|
|
||||||
uniform mat4 osg_ViewMatrixInverse;
|
uniform mat4 osg_ViewMatrixInverse;
|
||||||
|
|
||||||
attribute vec3 tangent;//, binormal;
|
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_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth);
|
||||||
light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * 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
|
// default lighting based on texture and material using the light we have just computed
|
||||||
|
|
||||||
gl_FrontColor = gl_Color;
|
gl_FrontColor = gl_Color;
|
||||||
|
|
Loading…
Reference in a new issue