GUI option and some internal tweaks for cloud shadow functionality
This commit is contained in:
parent
4ea8047b69
commit
426a4a0a6c
5 changed files with 80 additions and 28 deletions
|
@ -27,6 +27,7 @@
|
|||
<ground-haze-factor type="double" userarchive="y">1.0</ground-haze-factor>
|
||||
<aux-max-vis-range-m type="double" userarchive="y">11.69524</aux-max-vis-range-m>
|
||||
<max-vis-range-m type="double" userarchive="y">120000.0</max-vis-range-m>
|
||||
<generate-cloud-shadows type="bool" userarchive="y">0</generate-cloud-shadows>
|
||||
</config>
|
||||
<tmp>
|
||||
<tile-management type="string" userarchive="y">realistic weather</tile-management>
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -345,18 +345,42 @@
|
|||
<row>1</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Cloud shadows </label>
|
||||
</text>
|
||||
|
||||
<checkbox>
|
||||
<row>1</row>
|
||||
<col>2</col>
|
||||
<halign>left</halign>
|
||||
<property>/local-weather/config/generate-cloud-shadows</property>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
</checkbox>
|
||||
|
||||
<text>
|
||||
<row>1</row>
|
||||
<col>3</col>
|
||||
<halign>right</halign>
|
||||
<label>(needs ALS shaders)</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>2</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Convective conditions</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>1</row>
|
||||
<row>2</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>rough day</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<row>1</row>
|
||||
<row>2</row>
|
||||
<col>2</col>
|
||||
<min>0.3</min>
|
||||
<max>1.5</max>
|
||||
|
@ -367,28 +391,28 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<row>1</row>
|
||||
<row>2</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>low convection</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>2</row>
|
||||
<row>3</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Ground haze</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>2</row>
|
||||
<row>3</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>thick</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<row>2</row>
|
||||
<row>3</row>
|
||||
<col>2</col>
|
||||
<min>0.1</min>
|
||||
<max>1.0</max>
|
||||
|
@ -399,28 +423,28 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<row>2</row>
|
||||
<row>3</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>thin</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>3</row>
|
||||
<row>4</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Air pollution</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>3</row>
|
||||
<row>4</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>clean</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<row>3</row>
|
||||
<row>4</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>1.0</max>
|
||||
|
@ -431,28 +455,28 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<row>3</row>
|
||||
<row>4</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>smog</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<label>Fog properties</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>smooth</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>2</col>
|
||||
<min>0.0</min>
|
||||
<max>12.0</max>
|
||||
|
@ -463,14 +487,14 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<row>4</row>
|
||||
<row>5</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>structured</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>0</col>
|
||||
<halign>right</halign>
|
||||
<!--<enable>
|
||||
|
@ -483,14 +507,14 @@
|
|||
</text>
|
||||
|
||||
<text>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>1</col>
|
||||
<halign>right</halign>
|
||||
<label>20 km</label>
|
||||
</text>
|
||||
|
||||
<slider>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>2</col>
|
||||
<!--<enable>
|
||||
<equals>
|
||||
|
@ -507,14 +531,14 @@
|
|||
</slider>
|
||||
|
||||
<text>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>3</col>
|
||||
<halign>left</halign>
|
||||
<label>250 km</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<row>5</row>
|
||||
<row>6</row>
|
||||
<col>4</col>
|
||||
<halign>left</halign>
|
||||
<!--<enable>
|
||||
|
|
Loading…
Reference in a new issue