Improved light curves for Earthview in low light
This commit is contained in:
parent
676a40f912
commit
c275d3a8ad
2 changed files with 23 additions and 6 deletions
|
@ -31,6 +31,7 @@
|
||||||
<use-clouds><use>/earthview/cloudsphere-flag</use></use-clouds>
|
<use-clouds><use>/earthview/cloudsphere-flag</use></use-clouds>
|
||||||
<use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
|
<use-cloud-shadows><use>/earthview/cloud-shadow-flag</use></use-cloud-shadows>
|
||||||
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
||||||
|
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
|
||||||
</parameters>
|
</parameters>
|
||||||
<generate>
|
<generate>
|
||||||
<tangent type="int">6</tangent>
|
<tangent type="int">6</tangent>
|
||||||
|
@ -156,6 +157,13 @@
|
||||||
<use>visibility</use>
|
<use>visibility</use>
|
||||||
</value>
|
</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>sun_angle</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value>
|
||||||
|
<use>sun-angle</use>
|
||||||
|
</value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>use_clouds</name>
|
<name>use_clouds</name>
|
||||||
<type>bool</type>
|
<type>bool</type>
|
||||||
|
|
|
@ -9,6 +9,7 @@ varying vec3 ecViewDir;
|
||||||
varying vec3 VTangent;
|
varying vec3 VTangent;
|
||||||
|
|
||||||
uniform float visibility;
|
uniform float visibility;
|
||||||
|
uniform float sun_angle;
|
||||||
uniform bool use_clouds;
|
uniform bool use_clouds;
|
||||||
uniform bool use_cloud_shadows;
|
uniform bool use_cloud_shadows;
|
||||||
uniform bool use_overlay;
|
uniform bool use_overlay;
|
||||||
|
@ -28,9 +29,9 @@ void main()
|
||||||
vec3 n;
|
vec3 n;
|
||||||
float NdotL, NdotHV;
|
float NdotL, NdotHV;
|
||||||
vec4 color = gl_Color;
|
vec4 color = gl_Color;
|
||||||
vec3 lightDir = gl_LightSource[0].position.xyz;
|
vec3 lightDir = normalize(gl_LightSource[0].position.xyz);
|
||||||
|
|
||||||
vec3 halfVector = normalize(normalize(lightDir) + normalize(ecViewDir));
|
vec3 halfVector = normalize(lightDir + normalize(ecViewDir));
|
||||||
vec4 texel;
|
vec4 texel;
|
||||||
vec4 shadowTexel;
|
vec4 shadowTexel;
|
||||||
vec4 grainTexel;
|
vec4 grainTexel;
|
||||||
|
@ -45,8 +46,8 @@ void main()
|
||||||
vec3 VBinormal;
|
vec3 VBinormal;
|
||||||
VBinormal = cross(normal, VTangent);
|
VBinormal = cross(normal, VTangent);
|
||||||
|
|
||||||
float xOffset = -0.005 * dot(normalize(lightDir), normalize(VTangent));
|
float xOffset = -0.005 * dot(lightDir, normalize(VTangent));
|
||||||
float yOffset = -0.005 * dot(normalize(lightDir), normalize(VBinormal));
|
float yOffset = -0.005 * dot(lightDir, normalize(VBinormal));
|
||||||
|
|
||||||
if ((use_cloud_shadows)&&(use_clouds))
|
if ((use_cloud_shadows)&&(use_clouds))
|
||||||
{shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));}
|
{shadowTexel = texture2D(shadowtex, vec2(gl_TexCoord[0].s-xOffset, gl_TexCoord[0].t-yOffset));}
|
||||||
|
@ -110,8 +111,15 @@ void main()
|
||||||
|
|
||||||
float angle = dot(normalize(ecViewDir), normalize(normal));
|
float angle = dot(normalize(ecViewDir), normalize(normal));
|
||||||
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
float distance_through_atmosphere = min(10.0 / (abs(angle)+0.001),500.0);
|
||||||
|
|
||||||
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * clamp(NdotL,0.01, 0.99)),0.0,1.0);
|
|
||||||
|
|
||||||
|
float correction = smoothstep(-0.4, 0.0, dot(n, lightDir) - 0.45 ) ;
|
||||||
|
correction = correction + (1.0 - correction) * (1.0 - smoothstep(1.40, 1.57, sun_angle));
|
||||||
|
float correction1 = 1.0 - smoothstep(1.4, 1.45, sun_angle);
|
||||||
|
|
||||||
|
|
||||||
|
vec4 fogColor = vec4 (0.83,0.9,1.0,1.0) * clamp(length(diffuse_term.rgb/1.73 * correction * clamp(NdotL + correction1,0.01, 0.99) ),0.0,1.0);
|
||||||
|
|
||||||
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
float fogFactor = exp(-distance_through_atmosphere/(visibility/1000.0));
|
||||||
|
|
||||||
|
@ -120,4 +128,5 @@ void main()
|
||||||
|
|
||||||
|
|
||||||
gl_FragColor = fragColor;
|
gl_FragColor = fragColor;
|
||||||
|
//gl_FragColor = vec4 (NdotL - 0.5, NdotL - 0.5, NdotL - 0.5, 1.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue