1
0
Fork 0

Glass effect maintenance - lightcurve adjustment and damage support

This commit is contained in:
Thorsten Renk 2015-03-12 09:21:02 +02:00
parent c5c832d598
commit 419ae89ae2
4 changed files with 22 additions and 9 deletions

View file

@ -36,8 +36,10 @@
<gsnorm><use>/environment/aircraft-effects/ground-splash-norm</use></gsnorm>
<frost-level><use>/environment/aircraft-effects/frost-level</use></frost-level>
<fog-level><use>/environment/aircraft-effects/fog-level</use></fog-level>
<use-wipers><use>/environment/aircraft-effects/use-wipers</use></use-wipers>
<use-reflection type="int">0</use-reflection>
<use-mask type="int">0</use-mask>
</parameters>
<technique n="4">
@ -76,10 +78,6 @@
</blend>
<shade-model><use>shade-model</use></shade-model>
<cull-face><use>cull-face</use></cull-face>
<!--<render-bin>
<bin-number>1</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>-->
<rendering-hint><use>rendering-hint</use></rendering-hint>
<texture-unit>
<!-- The texture unit is always active because the shaders expect
@ -239,6 +237,11 @@
<type>int</type>
<value><use>use-mask</use></value>
</uniform>
<uniform>
<name>use_wipers</name>
<type>int</type>
<value><use>use-wipers</use></value>
</uniform>
<uniform>
<name>colorMode</name>
<type>int</type>

View file

@ -457,6 +457,7 @@
<frost-level type="float" userarchive="n">0.0</frost-level>
<fog-level type="float" userarchive="n">0.0</fog-level>
<ground-splash-norm type="float" userarchive="n">0.0</ground-splash-norm>
<use-wipers type="int" userarchive="n">0</use-wipers>
</aircraft-effects>

View file

@ -27,6 +27,7 @@ uniform float osg_SimulationTime;
uniform int use_reflection;
uniform int use_mask;
uniform int use_wipers;
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);
@ -43,13 +44,21 @@ texel = texture2D(texture, gl_TexCoord[0].st);
texel *=gl_Color;
frost_texel = texture2D(frost_texture, vertPos.xy * 7.0);
func_texel = texture2D(func_texture, gl_TexCoord[0].st
);
func_texel = texture2D(func_texture, gl_TexCoord[0].st);
float noise_003m = Noise2D(vertPos.xy, 0.03);
float noise_0003m = Noise2D(vertPos.xy, 0.003);
// damage_pattern
if (use_mask == 1)
{
texel = mix(texel, vec4(light_diffuse.rgb,1.0), func_texel.b);
}
// frost
float fth = (1.0-frost_level) * 0.4 + 0.3;
@ -95,7 +104,7 @@ if (rnorm > 0.0)
float time_shape = 1.0;
float base_rate = 6.0 + 3.0 * rnorm + 4.0 * (splash_speed - 1.0);
float base_density = 0.6 * rnorm + 0.4 * (splash_speed -1.0);
if (use_mask ==1) {base_density *= (1.0 - 0.5 * func_texel.g);}
if ((use_mask ==1)&&(use_wipers==1)) {base_density *= (1.0 - 0.5 * func_texel.g);}
float time_fact1 = (sin(base_rate*osg_SimulationTime));
float time_fact2 = (sin(base_rate*osg_SimulationTime + 1.570));
@ -117,7 +126,7 @@ if (rnorm > 0.0)
// the static pattern of small droplets created by the splashes
float sweep = min(1./splash_speed,1.0);
if (use_mask ==1) {sweep *= (1.0 - func_texel.g);}
if ((use_mask ==1)&&(use_wipers==1)) {sweep *= (1.0 - func_texel.g);}
rain_factor += DropletNoise2D(rainPos.xy, 0.02 * droplet_size ,0.5, 0.6* rnorm * sweep);
rain_factor += DotNoise2D(rainPos.xy, 0.012 * droplet_size ,0.7, 0.6* rnorm * sweep);
}

View file

@ -77,7 +77,7 @@ if (earthShade < 0.5)
float MieFactor = dot(normalize(lightFull), normalize(relPos));
Mie = smoothstep(0.9,1.0, MieFactor);
Mie = smoothstep(0.9,1.0, MieFactor) * earthShade * earthShade;
// get a reflection vector for cube map