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> <use>/sim/rendering/shaders/landmass</use>
</quality_level> </quality_level>
<!-- sea colors --> <!-- sea colors -->
<sea_r> <sea_r><use>/environment/sea/color_r</use></sea_r>
<use>/environment/sea/color_r</use> <sea_g><use>/environment/sea/color_g</use></sea_g>
</sea_r> <sea_b><use>/environment/sea/color_b</use></sea_b>
<sea_g>
<use>/environment/sea/color_g</use>
</sea_g>
<sea_b>
<use>/environment/sea/color_b</use>
</sea_b>
<!-- END fog include --> <!-- END fog include -->
</parameters> </parameters>
@ -378,11 +372,8 @@
</texture-unit> </texture-unit>
<program> <program>
<!-- <vertex-shader>Shaders/include_fog.vert</vertex-shader> --> <vertex-shader n="0">Shaders/wake-ALS.vert</vertex-shader>
<vertex-shader n="1">Shaders/wake-ALS.vert</vertex-shader> <fragment-shader n="0">Shaders/bowwave-ALS.frag</fragment-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>
</program> </program>
<uniform> <uniform>
<name>water_reflection</name> <name>water_reflection</name>
@ -539,10 +530,42 @@
</value> </value>
</uniform> </uniform>
<uniform> <uniform>
<name>cloud_self_shading</name> <name>cloud_self_shading</name>
<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>

View file

@ -8,6 +8,14 @@
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude> <altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading> <cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
<moonlight><use>/environment/moonlight</use></moonlight> <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> </parameters>
<technique n="9"> <technique n="9">
@ -58,6 +66,8 @@
<program> <program>
<vertex-shader>Shaders/cloud-static-ALS.vert</vertex-shader> <vertex-shader>Shaders/cloud-static-ALS.vert</vertex-shader>
<fragment-shader>Shaders/cloud-static-ALS.frag</fragment-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> </program>
<uniform> <uniform>
<name>baseTexture</name> <name>baseTexture</name>
@ -84,6 +94,46 @@
<type>float</type> <type>float</type>
<value><use>moonlight</use></value> <value><use>moonlight</use></value>
</uniform> </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> <vertex-program-two-side>true</vertex-program-two-side>
</pass> </pass>
</technique> </technique>

View file

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

View file

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

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

View file

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

View file

@ -59,6 +59,7 @@ vec3 specular_light;
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) ;
const float terminator_width = 200000.0; const float terminator_width = 200000.0;
const float EarthRadius = 5800000.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); gl_FragColor = vec4(finalColor.rgb, alpha0.a * 1.35);

View file

@ -3,10 +3,16 @@ varying float fogFactor;
varying vec3 hazeColor; varying vec3 hazeColor;
vec3 filter_combined (in vec3 color) ;
void main(void) void main(void)
{ {
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);
vec4 finalColor = base * gl_Color; 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; uniform sampler2D baseTexture;
varying float fogFactor; varying float fogFactor;
vec3 filter_combined (in vec3 color) ;
void main(void) void main(void)
{ {
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st); 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 landing_light(in float offset, in float offsetv);
vec3 rayleigh_out_shift(in vec3 color, in float outscatter); 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 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; 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 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 DropletNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density);
float Noise2D(in vec2 coord, in float wavelength); float Noise2D(in vec2 coord, in float wavelength);
vec3 filter_combined (in vec3 color) ;
void main() void main()
{ {
@ -245,6 +246,7 @@ vec4 fragColor;
fragColor.rgb = mix(outerColor.rgb, fog_texel.rgb, fog_texel.a); fragColor.rgb = mix(outerColor.rgb, fog_texel.rgb, fog_texel.a);
fragColor.a = max(outerColor.a, 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); 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 get_hazeColor(in float light_arg);
vec3 flashlight(in vec3 color, in float radius); vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float luminance(vec3 color) float luminance(vec3 color)
{ {
@ -175,7 +175,7 @@ void main()
} }
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor; 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 light_distance_fading(in float dist);
float fog_backscatter(in float avisibility); float fog_backscatter(in float avisibility);
//vec3 get_hazeColor(in float light_arg);
vec3 flashlight(in vec3 color, in float radius); vec3 flashlight(in vec3 color, in float radius);
vec3 filter_combined (in vec3 color) ;
float luminance(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 = 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; gl_FragColor = fragColor;