Improvements to Earthview: enable changing cloud density, fix aurora z-ordering issue, let moonlight give a relief effect to clouds
This commit is contained in:
parent
5334498037
commit
d9e55dc2e5
5 changed files with 71 additions and 21 deletions
|
@ -22,6 +22,7 @@
|
|||
<use-overlay-textures><use>/earthview/overlay-texture-flag</use></use-overlay-textures>
|
||||
<use-cloud-normals><use>/earthview/cloud-normal-flag</use></use-cloud-normals>
|
||||
<shade-effect><use>/earthview/shade-effect</use></shade-effect>
|
||||
<cloudcover-bias><use>/earthview/cloudcover-bias</use></cloudcover-bias>
|
||||
<sun-angle><use>/sim/time/sun-angle-rad</use></sun-angle>
|
||||
<moonlight><use>/environment/moonlight</use></moonlight>
|
||||
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||
|
@ -95,10 +96,10 @@
|
|||
<use>cull-face</use>
|
||||
</cull-face>
|
||||
<rendering-hint>transparent</rendering-hint>
|
||||
<render-bin>
|
||||
<bin-number>111</bin-number>
|
||||
<render-bin>
|
||||
<bin-number>110</bin-number>
|
||||
<bin-name>DepthSortedBin</bin-name>
|
||||
</render-bin>
|
||||
</render-bin>
|
||||
<texture-unit>
|
||||
<!-- The texture unit is always active because the shaders expect
|
||||
that. -->
|
||||
|
@ -188,11 +189,16 @@
|
|||
<use>shade-effect</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>cloudcover_bias</name>
|
||||
<type>float</type>
|
||||
<value><use>cloudcover-bias</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>air_pollution</name>
|
||||
<type>float</type>
|
||||
<value><use>air_pollution</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>sun_angle</name>
|
||||
<type>float</type>
|
||||
|
|
|
@ -16,6 +16,7 @@ uniform float moonlight;
|
|||
uniform float roi_x1;
|
||||
uniform float roi_y1;
|
||||
uniform float lightning;
|
||||
uniform float cloudcover_bias;
|
||||
|
||||
uniform bool use_overlay;
|
||||
uniform bool use_cloud_normals;
|
||||
|
@ -27,7 +28,6 @@ float Noise2D(in vec2 coord, in float wavelength);
|
|||
vec3 filter_combined (in vec3 color) ;
|
||||
vec3 moonlight_perception (in vec3 light);
|
||||
|
||||
|
||||
float add_cosines (in float cos1, in float cos2, in float sign)
|
||||
{
|
||||
|
||||
|
@ -86,11 +86,15 @@ void main()
|
|||
|
||||
vec3 tangent = normalize(VTangent);
|
||||
vec3 binormal = cross(n, tangent);
|
||||
float NdotL2 = 0.0;
|
||||
float NdotL2 = 1.0;
|
||||
|
||||
texel = texture2D(texture, gl_TexCoord[0].st);
|
||||
ref_texel = texel;
|
||||
|
||||
float sign = -1.0;
|
||||
float ml_fact = 1.0;
|
||||
|
||||
|
||||
if (use_cloud_normals)
|
||||
{
|
||||
vec2 sun2d = vec2 (0.0, 1.0);
|
||||
|
@ -114,7 +118,6 @@ void main()
|
|||
// relief shading based on gradient and parallax lookup
|
||||
|
||||
float slope = shade_effect * (comp_texel.a - ref_texel.a) * texel.a;
|
||||
float sign = -1.0;
|
||||
if (slope < 0.0) {sign = 1.0;}
|
||||
|
||||
vec2 snormal = normalize(vec2 (slope, 1.0));
|
||||
|
@ -122,10 +125,14 @@ void main()
|
|||
NdotL2 = dot (snormal, sun2d);
|
||||
NdotL = add_cosines(NdotL, NdotL2, sign );
|
||||
|
||||
|
||||
ml_fact = 0.5 + 1.0 * add_cosines(0.0, NdotL2, sign);
|
||||
|
||||
|
||||
}
|
||||
|
||||
ref_texel = texel;
|
||||
texel.a = pow(texel.a,1.0/cloudcover_bias);
|
||||
texel.a = clamp(texel.a, 0.0, 1.0);
|
||||
|
||||
|
||||
color += diff_term * max(NdotL, 0.15) ;
|
||||
|
@ -141,9 +148,8 @@ void main()
|
|||
color.rgb += lightning_color(gl_TexCoord[0].st) * (1.0 - texel.a) * lightning * darkness_fact;
|
||||
|
||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||
moonLightColor = moonlight_perception (moonLightColor);
|
||||
|
||||
color.rgb += moonLightColor;
|
||||
moonLightColor = moonlight_perception (moonLightColor);
|
||||
color.rgb += moonLightColor * ml_fact;
|
||||
|
||||
color.a = 1.0;//diffuse_term.a;
|
||||
color = clamp(color, 0.0, 1.0);
|
||||
|
@ -158,15 +164,16 @@ void main()
|
|||
vec4 noiseTexel = vec4 (1.0,1.0,1.0, 0.5* noise * texel.a);
|
||||
structureTexel = mix(structureTexel, noiseTexel,noiseTexel.a);
|
||||
|
||||
|
||||
structureTexel = mix(structureTexel, texel, clamp(1.5 * ref_texel.a * (cloudcover_bias - 1.0), 0.0, 1.0));
|
||||
|
||||
|
||||
if (use_overlay)
|
||||
{
|
||||
texel = vec4(structureTexel.rgb, smoothstep(0.0, 0.5,texel.a) * structureTexel.a);
|
||||
//texel.a = pow(texel.a,1.0/cloudcover_bias);
|
||||
|
||||
}
|
||||
|
||||
|
||||
texel.a = clamp((1.0 + darkness_fact) * texel.a, 0.0, 1.0);
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ float Noise2D(in vec2 coord, in float wavelength);
|
|||
vec3 filter_combined (in vec3 color) ;
|
||||
vec3 moonlight_perception (in vec3 light);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 n;
|
||||
|
@ -136,9 +135,9 @@ void main()
|
|||
* pow(NdotHV, gl_FrontMaterial.shininess));
|
||||
}
|
||||
|
||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||
moonLightColor = moonlight_perception (moonLightColor);
|
||||
color.rgb += moonLightColor;
|
||||
vec3 moonLightColor = vec3 (0.095, 0.095, 0.15) * moonlight;
|
||||
moonLightColor = moonlight_perception (moonLightColor);
|
||||
color.rgb += moonLightColor;
|
||||
|
||||
color.a = diffuse_term.a;
|
||||
|
||||
|
|
|
@ -1349,6 +1349,7 @@ Started September 2000 by David Megginson, david@megginson.com
|
|||
<earthview>
|
||||
<cloudsphere-flag type="bool" userarchive="y">true</cloudsphere-flag>
|
||||
<cloud-shadow-flag type="bool" userarchive="y">true</cloud-shadow-flag>
|
||||
<cloudcover-bias type="double" userarchive="y">1.0</cloudcover-bias>
|
||||
<overlay-texture-flag type="bool" userarchive="y">true</overlay-texture-flag>
|
||||
<mrd-flag type="bool" userarchive="y">true</mrd-flag>
|
||||
<cloudsphere-angle type="double" userarchive="n">0.0</cloudsphere-angle>
|
||||
|
|
|
@ -432,6 +432,43 @@
|
|||
<property>/environment/air-pollution-norm</property>
|
||||
</text>
|
||||
|
||||
<!-- gap -->
|
||||
<text>
|
||||
<label> </label>
|
||||
</text>
|
||||
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<halign>right</halign>
|
||||
|
||||
<!-- gap -->
|
||||
<text>
|
||||
<label> </label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<label>Cloudcover</label>
|
||||
</text>
|
||||
<slider>
|
||||
<name>cloudcover</name>
|
||||
<min>0.5</min>
|
||||
<max>2.0</max>
|
||||
<property>/earthview/cloudcover-bias</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
<object-name>cloudcover</object-name>
|
||||
</binding>
|
||||
<live>true</live>
|
||||
</slider>
|
||||
<text>
|
||||
<label>12345678</label>
|
||||
<format>%.1f</format>
|
||||
<live>true</live>
|
||||
<property>/earthview/cloudcover-bias</property>
|
||||
</text>
|
||||
|
||||
<!-- gap -->
|
||||
<text>
|
||||
<label> </label>
|
||||
|
|
Loading…
Reference in a new issue