1
0
Fork 0

Filtering for most remaining ALS shaders

This commit is contained in:
Thorsten Renk 2016-04-06 09:26:49 +03:00
parent 8071409961
commit 3146d6e4fe
13 changed files with 288 additions and 45 deletions

View file

@ -144,15 +144,9 @@
<use>/sim/rendering/shaders/landmass</use>
</quality_level>
<!-- sea colors -->
<sea_r>
<use>/environment/sea/color_r</use>
</sea_r>
<sea_g>
<use>/environment/sea/color_g</use>
</sea_g>
<sea_b>
<use>/environment/sea/color_b</use>
</sea_b>
<sea_r><use>/environment/sea/color_r</use></sea_r>
<sea_g><use>/environment/sea/color_g</use></sea_g>
<sea_b><use>/environment/sea/color_b</use></sea_b>
<!-- END fog include -->
</parameters>
@ -378,11 +372,8 @@
</texture-unit>
<program>
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
<vertex-shader n="1">Shaders/wake-ALS.vert</vertex-shader>
<!--<fragment-shader>Shaders/include_fog.frag</fragment-shader>-->
<fragment-shader n="1">Shaders/bowwave-ALS.frag</fragment-shader>
<fragment-shader n="2">Shaders/hazes.frag</fragment-shader>
<vertex-shader n="0">Shaders/wake-ALS.vert</vertex-shader>
<fragment-shader n="0">Shaders/bowwave-ALS.frag</fragment-shader>
</program>
<uniform>
<name>water_reflection</name>
@ -544,6 +535,38 @@
<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>

View file

@ -8,6 +8,14 @@
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
<moonlight><use>/environment/moonlight</use></moonlight>
<use_filtering><use>/sim/rendering/als-filters/use-filtering</use></use_filtering>
<gamma><use>/sim/rendering/als-filters/gamma</use></gamma>
<brightness><use>/sim/rendering/als-filters/brightness</use></brightness>
<delta_T><use>/environment/surface/delta-T-cloud</use></delta_T>
<use_night_vision><use>/sim/rendering/als-filters/use-night-vision</use></use_night_vision>
<use_IR_vision><use>/sim/rendering/als-filters/use-IR-vision</use></use_IR_vision>
<display_xsize><use>/sim/startup/xsize</use></display_xsize>
<display_ysize><use>/sim/startup/ysize</use></display_ysize>
</parameters>
<technique n="9">
@ -58,6 +66,8 @@
<program>
<vertex-shader>Shaders/cloud-static-ALS.vert</vertex-shader>
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
@ -84,6 +94,46 @@
<type>float</type>
<value><use>moonlight</use></value>
</uniform>
<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>
<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>
<vertex-program-two-side>true</vertex-program-two-side>
</pass>
</technique>

View file

@ -144,6 +144,7 @@
<fragment-shader n="2">Shaders/noise.frag</fragment-shader>
<fragment-shader n="3">Shaders/hazes.frag</fragment-shader>
<fragment-shader n="4">Shaders/secondary_lights.frag</fragment-shader>
<fragment-shader n="5">Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
<name>visibility</name>
@ -330,6 +331,38 @@
<type>float</type>
<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_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>
<!-- cloud shadows -->
<uniform>
<name>cloudpos1_x</name>
<type>float</type>

View file

@ -133,11 +133,7 @@
<wrap-t>
<use>texture[0]/wrap-t</use>
</wrap-t>
<!--
<internal-format>
<use>texture[0]/internal-format</use>
</internal-format>
-->
</texture-unit>
<texture-unit>
<unit>1</unit>
@ -151,12 +147,9 @@
<vertex-shader>Shaders/flutter-ALS.vert</vertex-shader>
<fragment-shader>Shaders/terrain-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>texture</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>-->
<uniform>
<name>colorMode</name>
<type>int</type>
@ -164,13 +157,6 @@
<use>material/color-mode-uniform</use>
</value>
</uniform>
<!-- uniform> unused?
<name>WindSpeed</name>
<type>float</type>
<value>
<use>wind-speed</use>
</value>
</uniform-->
<uniform>
<name>Offset</name>
<type>float</type>
@ -261,6 +247,47 @@
<value>
<use>fogtype</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>
<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>

View file

@ -157,6 +157,7 @@
<vertex-shader>Shaders/glass-ALS.vert</vertex-shader>
<fragment-shader>Shaders/glass-ALS.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
</program>
<uniform>
@ -309,6 +310,38 @@
<type>float</type>
<value><use>overlay-glare</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>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -142,8 +142,9 @@
<program>
<vertex-shader>Shaders/model-interior-ALS-detailed.vert</vertex-shader>
<fragment-shader>Shaders/model-interior-ALS-detailed.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>
<name>visibility</name>
@ -355,6 +356,37 @@
<type>float</type>
<value><use>residual-ambience-b</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>
<uniform>
<name>texture</name>
<type>sampler-2d</type>
@ -488,6 +520,8 @@
<fragment-shader>Shaders/model-interior-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>
<name>visibility</name>
@ -629,6 +663,37 @@
<type>int</type>
<value><use>display_ysize</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>
<uniform>
<name>texture</name>
<type>sampler-2d</type>

View file

@ -59,6 +59,7 @@ vec3 specular_light;
float fog_func (in float targ, in float alt);
vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
const float terminator_width = 200000.0;
const float EarthRadius = 5800000.0;
@ -436,7 +437,7 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
}
finalColor.rgb = filter_combined(finalColor.rgb);
gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35);

View file

@ -3,10 +3,16 @@ varying float fogFactor;
varying vec3 hazeColor;
vec3 filter_combined (in vec3 color) ;
void main(void)
{
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);
vec4 finalColor = base * gl_Color;
gl_FragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor );
gl_FragColor.a = mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor));
vec4 fragColor = vec4 (mix(hazeColor, finalColor.rgb, fogFactor ), mix(0.0, finalColor.a, 1.0 - 0.5 * (1.0 - fogFactor)));
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
}

View file

@ -1,6 +1,8 @@
uniform sampler2D baseTexture;
varying float fogFactor;
vec3 filter_combined (in vec3 color) ;
void main(void)
{
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);

View file

@ -80,7 +80,7 @@ vec3 searchlight();
vec3 landing_light(in float offset, in float offsetv);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
vec3 get_hazeColor(in float light_arg);
vec3 filter_combined (in vec3 color) ;
@ -495,6 +495,8 @@ fragColor.rgb = mix(hazeColor +secondary_light * fog_backscatter(mvisibility) ,
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
}

View file

@ -52,6 +52,7 @@ uniform vec3 lightmap_a_color;
float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density);
float DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density);
float Noise2D(in vec2 coord, in float wavelength);
vec3 filter_combined (in vec3 color) ;
void main()
{
@ -245,6 +246,7 @@ vec4 fragColor;
fragColor.rgb = mix(outerColor.rgb, fog_texel.rgb, fog_texel.a);
fragColor.a = max(outerColor.a, fog_texel.a);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = clamp(fragColor,0.0,1.0);

View file

@ -57,7 +57,7 @@ float fog_backscatter(in float avisibility);
vec3 get_hazeColor(in float light_arg);
vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float luminance(vec3 color)
{
@ -175,7 +175,7 @@ void main()
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;

View file

@ -70,9 +70,8 @@ float alt_factor(in float eye_alt, in float vertex_alt);
float light_distance_fading(in float dist);
float fog_backscatter(in float avisibility);
//vec3 get_hazeColor(in float light_arg);
vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float luminance(vec3 color)
{
@ -221,7 +220,7 @@ void main()
fragColor.rgb = max(fragColor.rgb, lightmapcolor.rgb * gl_FrontMaterial.diffuse.rgb * smoothstep(0.0, 1.0, texel.rgb*.5 + lightmapcolor.rgb*.5));
}
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;