diff --git a/Environment/local-weather-defaults.xml b/Environment/local-weather-defaults.xml index 5c7f532f0..a7c0ac76d 100644 --- a/Environment/local-weather-defaults.xml +++ b/Environment/local-weather-defaults.xml @@ -27,6 +27,7 @@ 1.0 11.69524 120000.0 + 0 realistic weather diff --git a/Nasal/local_weather/local_weather.nas b/Nasal/local_weather/local_weather.nas index 5086860ae..3aa3e51ac 100644 --- a/Nasal/local_weather/local_weather.nas +++ b/Nasal/local_weather/local_weather.nas @@ -1867,6 +1867,15 @@ if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand y = 200.0; edge = 1.0; create_streak(type,lat,lon, alt+ 0.5* (height*height_bias )-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + + if (local_weather.cloud_shadow_flag == 1) + { + var cs = local_weather.cloudShadow.new(lat, lon, 0.9 * (1.5 * x)/5000.0 , 0.7); + cs.index = getprop(lw~"tiles/tile-counter"); + append(cloudShadowCandidateArray,cs); + } + + } else if (size>0.4) @@ -1881,6 +1890,15 @@ if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand var alpha = rand() * 180.0; edge = edge + edge_bias; create_streak(type,lat,lon, alt+ 0.5* (height * height_bias)-offset_map["Cumulus"], height * height_bias,n,0.0,edge,x,1,0.0,0.0,y,alpha,1.0); + + if (local_weather.cloud_shadow_flag == 1) + { + var cs = local_weather.cloudShadow.new(lat, lon, 0.9 * (1.0 * x)/5000.0 , 0.6); + cs.index = getprop(lw~"tiles/tile-counter"); + append(cloudShadowCandidateArray,cs); + } + + } else { @@ -4012,7 +4030,7 @@ weather_tile_management.create_impostors(); # start the cloud shadow loop -local_weather.cloud_shadow_flag = getprop("/local-weather/cloud-shadows/cloud-shadow-flag"); +local_weather.cloud_shadow_flag = getprop("/local-weather/config/generate-cloud-shadows"); if (local_weather.cloud_shadow_flag == 1) { diff --git a/Nasal/local_weather/weather_tile_management.nas b/Nasal/local_weather/weather_tile_management.nas index f077736e7..1d1c15dae 100644 --- a/Nasal/local_weather/weather_tile_management.nas +++ b/Nasal/local_weather/weather_tile_management.nas @@ -1279,7 +1279,17 @@ var s = size(active_tile_list); # don't do anything as long as the array is empty if (n_max == 0) # nothing to do, loop over - {if (getprop(lw~"shadow-loop-flag") ==1) {settimer( func {shadow_management_loop(index)}, 0);} return;} + { + setprop("/local-weather/cloud-shadows/cloud-shadow-flag",0); + if (getprop(lw~"shadow-loop-flag") ==1) {settimer( func {shadow_management_loop(index)}, 0);} + return; + } +else + { + setprop("/local-weather/cloud-shadows/cloud-shadow-flag",1); + } + + # compute some general-purpose stuff for the loop @@ -1374,7 +1384,7 @@ foreach(s; cloudShadowArray) if (dist > dist_max) {dist_max = dist; index_max = counter;} setprop("/local-weather/cloud-shadows/cloudpos-x["~counter~"]",int(diffx) + s.size); - setprop("/local-weather/cloud-shadows/cloudpos-y["~counter~"]",int(diffy) + 0.9 ); + setprop("/local-weather/cloud-shadows/cloudpos-y["~counter~"]",int(diffy) + s.strength ); counter = counter+1; } #print("Dist_max:", dist_max, " index_max: ", index_max); diff --git a/Shaders/cloud-shadowfunc.frag b/Shaders/cloud-shadowfunc.frag index c1d44edac..0a9b995be 100644 --- a/Shaders/cloud-shadowfunc.frag +++ b/Shaders/cloud-shadowfunc.frag @@ -128,11 +128,10 @@ dlength = length ( vec2 (x - cloudpos20_x, y - cloudpos20_y)); width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y)); shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); -shadeValue = clamp(shadeValue * (0.5 + 2.0 * noise),0.0,1.0); - +shadeValue = shadeValue * (0.8 + 2.0 * shadeValue * smoothstep(0.4,0.6,noise)); +shadeValue = clamp(shadeValue,0.0,1.0); shadeValue = shadeValue * (1.0 - smoothstep(15000.0, 30000.0,dist)); -//shadeValue = clamp(shadeValue * (0.5 + 0.5 * noise),0.0,1.0); -return 1.0 - shadeValue;// exp(- (dlength * dlength)/(width*width)); +return 1.0 - shadeValue; } diff --git a/gui/dialogs/local_weather_tiles.xml b/gui/dialogs/local_weather_tiles.xml index 87ed86e93..24b8c05f3 100644 --- a/gui/dialogs/local_weather_tiles.xml +++ b/gui/dialogs/local_weather_tiles.xml @@ -341,22 +341,46 @@ - + 1 0 right + + + + + 1 + 2 + left + /local-weather/config/generate-cloud-shadows + + dialog-apply + + + + + 1 + 3 + right + + + + + 2 + 0 + right - 1 + 2 1 right - 1 + 2 2 0.3 1.5 @@ -367,28 +391,28 @@ - 1 + 2 3 left - 2 + 3 0 right - 2 + 3 1 right - 2 + 3 2 0.1 1.0 @@ -399,28 +423,28 @@ - 2 + 3 3 left - 3 + 4 0 right - 3 + 4 1 right - 3 + 4 2 0.0 1.0 @@ -431,28 +455,28 @@ - 3 + 4 3 left - 4 + 5 0 right - 4 + 5 1 right - 4 + 5 2 0.0 12.0 @@ -463,14 +487,14 @@ - 4 + 5 3 left - 5 + 6 0 right