Corrections to shadow sharpness, made sure shadows of buildings appear below forests
This commit is contained in:
parent
0cbc59fd61
commit
265197d295
@ -117,12 +117,12 @@ mstr_ortho_layers = [
|
|||||||
("landuse", "residential", "landuse", "residential-boundary"),
|
("landuse", "residential", "landuse", "residential-boundary"),
|
||||||
("landuse", "grass", "landuse", "grass"),
|
("landuse", "grass", "landuse", "grass"),
|
||||||
("landuse", "cemetery", "landuse", "grass"),
|
("landuse", "cemetery", "landuse", "grass"),
|
||||||
|
("landuse", "recreation_ground", "landuse", "meadow"),
|
||||||
|
("leisure", "golf_course", "leisure", "golf_course"),
|
||||||
("landuse", "greenfield", "landuse", "grass"),
|
("landuse", "greenfield", "landuse", "grass"),
|
||||||
("landuse", "orchard", "landuse", "meadow"),
|
("landuse", "orchard", "landuse", "meadow"),
|
||||||
("landuse", "meadow", "landuse", "meadow"),
|
("landuse", "meadow", "landuse", "meadow"),
|
||||||
("natural", "grassland", "landuse", "meadow"),
|
("natural", "grassland", "landuse", "meadow"),
|
||||||
("landuse", "recreation_ground", "landuse", "meadow"),
|
|
||||||
("leisure", "golf_course", "leisure", "golf_course"),
|
|
||||||
("barrier", "hedge", "natural", "heath"),
|
("barrier", "hedge", "natural", "heath"),
|
||||||
("landuse", "vineyard", "landuse", "meadow"),
|
("landuse", "vineyard", "landuse", "meadow"),
|
||||||
("natural", "bare_rock", "natural", "bare_rock"),
|
("natural", "bare_rock", "natural", "bare_rock"),
|
||||||
@ -419,4 +419,4 @@ mstr_completion_colors = [
|
|||||||
(137,137,107)
|
(137,137,107)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -610,7 +610,7 @@ class mstr_layergen:
|
|||||||
if lp[3] >= 250:
|
if lp[3] >= 250:
|
||||||
shadow_pix[x,y] = (0,0,0,0)
|
shadow_pix[x,y] = (0,0,0,0)
|
||||||
|
|
||||||
shadow = shadow.filter(ImageFilter.GaussianBlur(radius=2))
|
shadow = shadow.filter(ImageFilter.GaussianBlur(radius=1.5))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for y in range(self._imgsize-1):
|
for y in range(self._imgsize-1):
|
||||||
|
19
photogen.py
19
photogen.py
@ -45,6 +45,9 @@ class mstr_photogen:
|
|||||||
# First, we walk through all layers and blend them on top of each other, in order
|
# First, we walk through all layers and blend them on top of each other, in order
|
||||||
mstr_msg("photogen", "Merging layers")
|
mstr_msg("photogen", "Merging layers")
|
||||||
|
|
||||||
|
# Note if we added building shadows
|
||||||
|
bldg_shadow_added = False
|
||||||
|
|
||||||
# Shadow merging
|
# Shadow merging
|
||||||
bldg_shadow = Image.new("RGBA", (self._imgsize, self._imgsize))
|
bldg_shadow = Image.new("RGBA", (self._imgsize, self._imgsize))
|
||||||
if mstr_shadow_enabled == True:
|
if mstr_shadow_enabled == True:
|
||||||
@ -80,7 +83,7 @@ class mstr_photogen:
|
|||||||
# Merge the building layers
|
# Merge the building layers
|
||||||
bldg_final = Image.new("RGBA", (self._imgsize, self._imgsize))
|
bldg_final = Image.new("RGBA", (self._imgsize, self._imgsize))
|
||||||
bldg_final.alpha_composite(bldg_details)
|
bldg_final.alpha_composite(bldg_details)
|
||||||
bldg_final.alpha_composite(bldg_shadow)
|
#bldg_final.alpha_composite(bldg_shadow)
|
||||||
bldg_final.alpha_composite(tree_main)
|
bldg_final.alpha_composite(tree_main)
|
||||||
bldg_final.alpha_composite(bldg_main)
|
bldg_final.alpha_composite(bldg_main)
|
||||||
|
|
||||||
@ -88,6 +91,18 @@ class mstr_photogen:
|
|||||||
if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer.png"):
|
if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer.png"):
|
||||||
# Need to divert in case we have shadows
|
# Need to divert in case we have shadows
|
||||||
if mstr_shadow_enabled == True:
|
if mstr_shadow_enabled == True:
|
||||||
|
|
||||||
|
# Make sure building shadows appear below forests
|
||||||
|
shdc = False
|
||||||
|
for s in mstr_shadow_casters:
|
||||||
|
if s[0] == l[0] and s[1] == l[1]:
|
||||||
|
shdc = True
|
||||||
|
break
|
||||||
|
if shdc == True:
|
||||||
|
if bldg_shadow_added == False:
|
||||||
|
self._tile.alpha_composite(bldg_shadow)
|
||||||
|
bldg_shadow_added = True
|
||||||
|
|
||||||
if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"):
|
if os.path.isfile(root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"):
|
||||||
if l[0] != "building":
|
if l[0] != "building":
|
||||||
sn = root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"
|
sn = root_filename + l[0] + "-" + l[1] + "_layer_shadow.png"
|
||||||
@ -265,4 +280,4 @@ class mstr_photogen:
|
|||||||
if abs(numbers[1]) >= 10 and numbers[0] <= 99: fstr = fstr + "0" + str(numbers[1])
|
if abs(numbers[1]) >= 10 and numbers[0] <= 99: fstr = fstr + "0" + str(numbers[1])
|
||||||
if abs(numbers[1]) >= 100 : fstr = fstr + str(numbers[1])
|
if abs(numbers[1]) >= 100 : fstr = fstr + str(numbers[1])
|
||||||
|
|
||||||
return fstr
|
return fstr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user