Adjusted forest rendering to make those appear a bit more realistic, while retaining Perlin noise coloring

This commit is contained in:
Marcus Str. 2025-02-02 20:43:28 +01:00
parent b3d5fca112
commit 6b66715334
2 changed files with 15 additions and 1 deletions

View File

@ -407,6 +407,20 @@ class mstr_layergen:
tmp_layer.putalpha(51)
layer.alpha_composite(tmp_layer)
# Let's make some noise to give forests some better look
if (self._tag == "landuse" and self._value == "forest") or (self._tag == "leisure" and self._value == "nature_reserve"):
frst_noise = Image.new("RGBA", (self._imgsize, self._imgsize))
frst_pix = frst_noise.load()
for n in range(0, 1500000):
nx = randrange(0, self._imgsize)
ny = randrange(0, self._imgsize)
na = randrange(65, 241)
nc = (0,0,0,na)
frst_pix[nx,ny] = nc
frst_noise = frst_noise.filter(ImageFilter.GaussianBlur(radius=1))
layer.alpha_composite(frst_noise)
mstr_msg("layergen", "Layer image generated")
#---------------------------------------------

View File

@ -532,7 +532,7 @@ class mstr_photogen:
# Let's see if we can correct that
# These files will need to be generated after manual check of the orthos
if os.path.isfile(mstr_datafolder + "z_orthographic/data" + self._latlngfld + "/water/" + str(self._ty) + "_" + str(self._tx)) == True:
if os.path.isfile(mstr_datafolder + "z_orthographic/data/" + self._latlngfld + "/water/" + str(self._ty) + "_" + str(self._tx)) == True:
# natural:water
ntrl_water = False
ntrl_idx = 0