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/model-ALS-base.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/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader> <fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program> </program>
<uniform> <uniform>

View file

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

View file

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

View file

@ -610,6 +610,7 @@
<type>float</type> <type>float</type>
<value><use>landing_light3_offset</use></value> <value><use>landing_light3_offset</use></value>
</uniform> </uniform>
<!-- filtering -->
<uniform> <uniform>
<name>gamma</name> <name>gamma</name>
<type>float</type> <type>float</type>
@ -1095,6 +1096,8 @@
<vertex-shader>Shaders/water-ALS.vert</vertex-shader> <vertex-shader>Shaders/water-ALS.vert</vertex-shader>
<fragment-shader>Shaders/water-ALS-base.frag</fragment-shader> <fragment-shader>Shaders/water-ALS-base.frag</fragment-shader>
<fragment-shader>Shaders/hazes.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> </program>
<!--<uniform> <!--<uniform>
<name>water_reflection</name> <name>water_reflection</name>
@ -1270,6 +1273,37 @@
<type>float</type> <type>float</type>
<value><use>air_pollution</use></value> <value><use>air_pollution</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_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 --> <!-- sea colors -->
<uniform> <uniform>
<name>sea_r</name> <name>sea_r</name>
@ -1297,6 +1331,16 @@
<type>int</type> <type>int</type>
<value>1</value> <value>1</value>
</uniform> </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 --> <!-- END fog include -->
</pass> </pass>
</technique> </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 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) ;
float luminance(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; 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); float fog_func (in float targ, in float alt);
vec3 get_hazeColor(in float light_arg); 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; gl_FragColor = fragColor;

View file

@ -40,6 +40,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;
float earthShade; 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_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
diffuse_term = diffuse_color* light_diffuse; 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); float fog_func (in float targ, in float alt);
vec3 get_hazeColor(in float light_arg); vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
/////// functions ///////// /////// 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; gl_FragColor = finalColor;
} }