1
0
Fork 0

Rain layer effect to ALS filtering

This commit is contained in:
Thorsten Renk 2016-04-08 15:57:59 +03:00
parent 5134fa2a61
commit f3d79f18e3
2 changed files with 61 additions and 4 deletions

View file

@ -12,6 +12,14 @@
<lightning-pos-y><use>/environment/lightning/lightning-pos-y</use></lightning-pos-y>
<lightning-range><use>/environment/lightning/lightning-range</use></lightning-range>
<is-lightning type="bool">0</is-lightning>
<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">
<predicate>
@ -61,6 +69,8 @@
<program>
<vertex-shader>Shaders/rain-layer-ALS.vert</vertex-shader>
<fragment-shader>Shaders/rain-layer-ALS.frag</fragment-shader>
<fragment-shader>Shaders/filters-ALS.frag</fragment-shader>
<fragment-shader>Shaders/noise.frag</fragment-shader>
</program>
<uniform>
<name>baseTexture</name>
@ -107,6 +117,46 @@
<type>bool</type>
<value><use>is-lightning</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

@ -3,6 +3,8 @@ varying float fogFactor;
varying vec3 hazeColor;
varying vec3 relVector;
vec3 filter_combined (in vec3 color) ;
uniform bool is_lightning;
vec3 rainbow (in float index)
@ -31,7 +33,7 @@ void main(void)
vec4 base = texture2D( baseTexture, gl_TexCoord[0].st);
vec4 finalColor = base * gl_Color;
vec4 fragColor;
if (is_lightning==false)
@ -49,9 +51,14 @@ void main(void)
finalColor.rgb = mix(finalColor.rgb, rainbow_color, 0.5* rainbow_shape);
gl_FragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor );
fragColor.rgb = mix(hazeColor, finalColor.rgb, fogFactor );
}
else
{gl_FragColor.rgb = finalColor;}
gl_FragColor.a = mix(0.0, finalColor.a, fogFactor);
{fragColor.rgb = finalColor;}
fragColor.a = mix(0.0, finalColor.a, fogFactor);
fragColor.rgb = filter_combined(fragColor.rgb);
gl_FragColor = fragColor;
}