1
0
Fork 0

Enable filtering for ALS lower quality terrain, water and model shaders

This commit is contained in:
Thorsten Renk 2016-03-27 20:27:32 +03:00
parent 28f7caa800
commit bb8e93da97
8 changed files with 147 additions and 2 deletions

View file

@ -114,6 +114,7 @@
<fragment-shader>Shaders/model-ALS-base.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>

View file

@ -923,6 +923,7 @@
<fragment-shader>Shaders/terrain-ALS-detailed.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
@ -1029,6 +1030,47 @@
<type>float</type>
<value><use>season</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>
<name>display_xsize</name>
<type>int</type>
<value><use>display_xsize</use></value>
</uniform>
<uniform>
<name>display_ysize</name>
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<uniform>
<name>quality_level</name>
<type>int</type>

View file

@ -1103,6 +1103,8 @@
<vertex-shader>Shaders/water-ALS.vert</vertex-shader>
<fragment-shader>Shaders/water-ALS-base.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<!--<uniform>
<name>water_reflection</name>
@ -1273,6 +1275,37 @@
<type>float</type>
<value><use>cloud_self_shading</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_filtering</name>
<type>bool</type>
<value><use>use_filtering</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>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<!-- sea colors -->
<uniform>
<name>sea_r</name>
@ -1300,6 +1333,16 @@
<type>int</type>
<value>0</value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>
<value><use>display_xsize</use></value>
</uniform>
<uniform>
<name>display_ysize</name>
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<!-- END fog include -->
</pass>
</technique>

View file

@ -610,6 +610,7 @@
<type>float</type>
<value><use>landing_light3_offset</use></value>
</uniform>
<!-- filtering -->
<uniform>
<name>gamma</name>
<type>float</type>
@ -1095,6 +1096,8 @@
<vertex-shader>Shaders/water-ALS.vert</vertex-shader>
<fragment-shader>Shaders/water-ALS-base.frag</fragment-shader>
<fragment-shader>Shaders/hazes.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<!--<uniform>
<name>water_reflection</name>
@ -1270,6 +1273,37 @@
<type>float</type>
<value><use>air_pollution</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_filtering</name>
<type>bool</type>
<value><use>use_filtering</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>delta_T</name>
<type>float</type>
<value><use>delta_T</use></value>
</uniform>
<!-- sea colors -->
<uniform>
<name>sea_r</name>
@ -1297,6 +1331,16 @@
<type>int</type>
<value>1</value>
</uniform>
<uniform>
<name>display_xsize</name>
<type>int</type>
<value><use>display_xsize</use></value>
</uniform>
<uniform>
<name>display_ysize</name>
<type>int</type>
<value><use>display_ysize</use></value>
</uniform>
<!-- END fog include -->
</pass>
</technique>

View file

@ -53,7 +53,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) ;
float luminance(vec3 color)
{
@ -313,6 +313,8 @@ fragColor.rgb = mix(hazeColor + secondary_light * fog_backscatter(mvisibility),
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
}

View file

@ -53,7 +53,7 @@ float Noise3D(in vec3 coord, in float wavelength);
float fog_func (in float targ, in float alt);
vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
@ -494,6 +494,8 @@ fragColor.rgb = mix(clamp(hazeColor,0.0,1.0) , clamp(fragColor.rgb,0.0,1.0),tran
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;

View file

@ -40,6 +40,8 @@ uniform float ground_scattering;
uniform float eye_alt;
uniform float moonlight;
uniform bool use_IR_vision;
uniform mat4 osg_ViewMatrixInverse;
float earthShade;
@ -268,6 +270,11 @@ 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
diffuse_term = diffuse_color* light_diffuse;

View file

@ -62,6 +62,7 @@ const float EarthRadius = 5800000.0;
float fog_func (in float targ, in float alt);
vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
/////// functions /////////
@ -551,6 +552,9 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
}
finalColor.rgb = filter_combined(finalColor.rgb);
gl_FragColor = finalColor;
}