1
0
Fork 0

GUI option and some internal tweaks for cloud shadow functionality

This commit is contained in:
Thorsten Renk 2014-04-17 12:39:53 +03:00
parent 4ea8047b69
commit 426a4a0a6c
5 changed files with 80 additions and 28 deletions

View file

@ -27,6 +27,7 @@
<ground-haze-factor type="double" userarchive="y">1.0</ground-haze-factor> <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> <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> <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> </config>
<tmp> <tmp>
<tile-management type="string" userarchive="y">realistic weather</tile-management> <tile-management type="string" userarchive="y">realistic weather</tile-management>

View file

@ -1867,6 +1867,15 @@ if (edge_bias > 0.0) {height_bias = height_bias + 15.0 *edge_bias + 20.0 * rand
y = 200.0; y = 200.0;
edge = 1.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); 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) 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; var alpha = rand() * 180.0;
edge = edge + edge_bias; 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); 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 else
{ {
@ -4012,7 +4030,7 @@ weather_tile_management.create_impostors();
# start the cloud shadow loop # 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) if (local_weather.cloud_shadow_flag == 1)
{ {

View file

@ -1279,7 +1279,17 @@ var s = size(active_tile_list);
# don't do anything as long as the array is empty # don't do anything as long as the array is empty
if (n_max == 0) # nothing to do, loop over 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 # 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;} 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-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; counter = counter+1;
} }
#print("Dist_max:", dist_max, " index_max: ", index_max); #print("Dist_max:", dist_max, " index_max: ", index_max);

View file

@ -128,11 +128,10 @@ dlength = length ( vec2 (x - cloudpos20_x, y - cloudpos20_y));
width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y)); width = fract((cloudpos20_x)) * 5000.0; strength = fract((cloudpos20_y));
shadeValue = shadeValue + strength * (1.0-smoothstep(width * 0.5, width, dlength)); 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 = 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;
} }

View file

@ -345,18 +345,42 @@
<row>1</row> <row>1</row>
<col>0</col> <col>0</col>
<halign>right</halign> <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> <label>Convective conditions</label>
</text> </text>
<text> <text>
<row>1</row> <row>2</row>
<col>1</col> <col>1</col>
<halign>right</halign> <halign>right</halign>
<label>rough day</label> <label>rough day</label>
</text> </text>
<slider> <slider>
<row>1</row> <row>2</row>
<col>2</col> <col>2</col>
<min>0.3</min> <min>0.3</min>
<max>1.5</max> <max>1.5</max>
@ -367,28 +391,28 @@
</slider> </slider>
<text> <text>
<row>1</row> <row>2</row>
<col>3</col> <col>3</col>
<halign>left</halign> <halign>left</halign>
<label>low convection</label> <label>low convection</label>
</text> </text>
<text> <text>
<row>2</row> <row>3</row>
<col>0</col> <col>0</col>
<halign>right</halign> <halign>right</halign>
<label>Ground haze</label> <label>Ground haze</label>
</text> </text>
<text> <text>
<row>2</row> <row>3</row>
<col>1</col> <col>1</col>
<halign>right</halign> <halign>right</halign>
<label>thick</label> <label>thick</label>
</text> </text>
<slider> <slider>
<row>2</row> <row>3</row>
<col>2</col> <col>2</col>
<min>0.1</min> <min>0.1</min>
<max>1.0</max> <max>1.0</max>
@ -399,28 +423,28 @@
</slider> </slider>
<text> <text>
<row>2</row> <row>3</row>
<col>3</col> <col>3</col>
<halign>left</halign> <halign>left</halign>
<label>thin</label> <label>thin</label>
</text> </text>
<text> <text>
<row>3</row> <row>4</row>
<col>0</col> <col>0</col>
<halign>right</halign> <halign>right</halign>
<label>Air pollution</label> <label>Air pollution</label>
</text> </text>
<text> <text>
<row>3</row> <row>4</row>
<col>1</col> <col>1</col>
<halign>right</halign> <halign>right</halign>
<label>clean</label> <label>clean</label>
</text> </text>
<slider> <slider>
<row>3</row> <row>4</row>
<col>2</col> <col>2</col>
<min>0.0</min> <min>0.0</min>
<max>1.0</max> <max>1.0</max>
@ -431,28 +455,28 @@
</slider> </slider>
<text> <text>
<row>3</row> <row>4</row>
<col>3</col> <col>3</col>
<halign>left</halign> <halign>left</halign>
<label>smog</label> <label>smog</label>
</text> </text>
<text> <text>
<row>4</row> <row>5</row>
<col>0</col> <col>0</col>
<halign>right</halign> <halign>right</halign>
<label>Fog properties</label> <label>Fog properties</label>
</text> </text>
<text> <text>
<row>4</row> <row>5</row>
<col>1</col> <col>1</col>
<halign>right</halign> <halign>right</halign>
<label>smooth</label> <label>smooth</label>
</text> </text>
<slider> <slider>
<row>4</row> <row>5</row>
<col>2</col> <col>2</col>
<min>0.0</min> <min>0.0</min>
<max>12.0</max> <max>12.0</max>
@ -463,14 +487,14 @@
</slider> </slider>
<text> <text>
<row>4</row> <row>5</row>
<col>3</col> <col>3</col>
<halign>left</halign> <halign>left</halign>
<label>structured</label> <label>structured</label>
</text> </text>
<text> <text>
<row>5</row> <row>6</row>
<col>0</col> <col>0</col>
<halign>right</halign> <halign>right</halign>
<!--<enable> <!--<enable>
@ -483,14 +507,14 @@
</text> </text>
<text> <text>
<row>5</row> <row>6</row>
<col>1</col> <col>1</col>
<halign>right</halign> <halign>right</halign>
<label>20 km</label> <label>20 km</label>
</text> </text>
<slider> <slider>
<row>5</row> <row>6</row>
<col>2</col> <col>2</col>
<!--<enable> <!--<enable>
<equals> <equals>
@ -507,14 +531,14 @@
</slider> </slider>
<text> <text>
<row>5</row> <row>6</row>
<col>3</col> <col>3</col>
<halign>left</halign> <halign>left</halign>
<label>250 km</label> <label>250 km</label>
</text> </text>
<text> <text>
<row>5</row> <row>6</row>
<col>4</col> <col>4</col>
<halign>left</halign> <halign>left</halign>
<!--<enable> <!--<enable>