ALS maintenance: bugfix for cloud impostors, 'inverse' Mie for cloud shader, glare for translucent objects proportional to 1-alpha rather than on-off
This commit is contained in:
parent
1d0c206418
commit
379dd17b3d
3 changed files with 66 additions and 6 deletions
|
@ -60,6 +60,8 @@
|
|||
<program>
|
||||
<vertex-shader>Shaders/cloud-impostor-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>
|
||||
|
@ -96,6 +98,46 @@
|
|||
<type>float</type>
|
||||
<value><use>air_pollution</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>
|
||||
|
|
|
@ -209,15 +209,16 @@ void main(void)
|
|||
|
||||
|
||||
// Mie correction
|
||||
float Mie;
|
||||
float MieFactor;
|
||||
float Mie = 0.0;
|
||||
float MieFactor = 0.0;
|
||||
|
||||
if (bottom_factor > 0.6)
|
||||
if (bottom_factor > 0.4)
|
||||
{
|
||||
MieFactor = dot(normalize(lightFull), normalize(relVector));
|
||||
Mie = 1.5 * smoothstep(0.9,1.0, MieFactor) * smoothstep(0.6, 0.8, bottom_factor) * (1.0-earthShadeFactor) ;
|
||||
//if (MieFactor < 0.0) {Mie = - Mie;}
|
||||
}
|
||||
else {Mie = 0.0;}
|
||||
//else {Mie = 0.0;}
|
||||
|
||||
if (Mie > 0.0)
|
||||
{
|
||||
|
@ -229,6 +230,23 @@ void main(void)
|
|||
gl_FrontColor.g = mie_func(gl_FrontColor.g, 0.8* Mie);
|
||||
gl_FrontColor.b = mie_func(gl_FrontColor.b, 0.5*Mie);
|
||||
}
|
||||
else if (MieFactor < 0.0)
|
||||
{
|
||||
float thickness_reduction = smoothstep(0.4, 0.8, bottom_factor) ;
|
||||
float light_reduction = dot (lightFull, lightHorizon);
|
||||
light_reduction *= light_reduction;
|
||||
|
||||
float factor_b = 0.8 + 0.2 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ;
|
||||
float factor_r = 0.6 + 0.4 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ;
|
||||
float factor_g = 0.65 + 0.35 * (1.0 - smoothstep(0.0, 0.7, -MieFactor) * thickness_reduction * light_reduction) ;
|
||||
hazeColor.r *= factor_r;
|
||||
hazeColor.g *= factor_g;
|
||||
hazeColor.b *= factor_b;
|
||||
|
||||
gl_FrontColor.r *= factor_r;
|
||||
gl_FrontColor.g *= factor_g;
|
||||
gl_FrontColor.b *= factor_b;
|
||||
}
|
||||
|
||||
gl_FrontColor.rgb = gl_FrontColor.rgb + moonLightColor * earthShadeFactor;
|
||||
hazeColor.rgb = hazeColor.rgb + moonLightColor * earthShadeFactor;
|
||||
|
|
|
@ -253,8 +253,8 @@ void main (void)
|
|||
//glare on the backside of tranparent objects
|
||||
if ((gl_FrontMaterial.diffuse.a < 1.0 || texel.a < 1.0)
|
||||
&& dot(N, normalize(gl_LightSource[0].position.xyz)) < 0.0) {
|
||||
nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz)));
|
||||
nDotHV = max(0.0, dot(-N, normalize(gl_LightSource[0].halfVector.xyz)));
|
||||
nDotVP = max(0.0, dot(-N, normalize(gl_LightSource[0].position.xyz)) * (1.0 -texel.a) );
|
||||
nDotHV = max(0.0, dot(-N, normalize(gl_LightSource[0].halfVector.xyz)) * (1.0 -texel.a) );
|
||||
}
|
||||
|
||||
float nDotVP1 = 0.0;
|
||||
|
|
Loading…
Reference in a new issue