From: marstr Date: Sun, 1 Sep 2024 11:53:34 +0000 (+0200) Subject: Made small inland rivers and streams blend much more naturally into the environment. X-Git-Url: https://marstr.online/code/gitweb.cgi?a=commitdiff_plain;h=d180f75e0799140ef85a1dd8c765aecf54f2f0ac;p=orthographic Made small inland rivers and streams blend much more naturally into the environment. --- diff --git a/layergen.py b/layergen.py index d25a772..8e366e9 100644 --- a/layergen.py +++ b/layergen.py @@ -293,12 +293,6 @@ class mstr_layergen: osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2)) layer_border = self.genborder(osm_edge, "landuse", "meadow") layer_comp.alpha_composite(layer_border) - # Give streams a more natural look - if self._tag == "waterway" and (self._value == "stream" or self._value == "river"): - osm_edge = osm_edge.filter(ImageFilter.ModeFilter(size=15)) - osm_edge = osm_edge.filter(ImageFilter.BoxBlur(radius=2)) - layer_border = self.genborder(osm_edge, "natural", "wetland") - layer_comp.alpha_composite(layer_border) # Store layer @@ -454,7 +448,13 @@ class mstr_layergen: layer_comp_pix[x, y] = ( r,g,b,a[3] ) if self._tag == "waterway" and (self._value == "stream" or self._value == "river"): d = randrange(1, 15) - layer_comp_pix[x, y] = ( 129-d, 148-d, 159-d, a[3] ) + # Rock, grass, water + mats = [ (48-d, 45-d, 42-d), (58-d, 81-d, 41-d), (129-d, 148-d, 159-d) ] + # Pick one of those + pick = randrange(1,4) + t = a[3]-d + if t < 0: t = 0 + layer_comp_pix[x, y] = ( mats[pick-1][0], mats[pick-1][1], mats[pick-1][2], t ) if self._tag == "building": r = randrange(1, 20) @@ -485,6 +485,7 @@ class mstr_layergen: g = 159 - d b = 138 - d layer_comp_pix[x, y] = ( r,g,b,a[3] ) + mstr_msg("mstr_layergen", "Layer image generated") # Building shadow @@ -522,8 +523,9 @@ class mstr_layergen: mstr_msg("mstr_layergen", "Street lines added") + if self._tag == "waterway" and (self._value == "river" or self._value == "stream"): + layer_comp = layer_comp.filter(ImageFilter.GaussianBlur(radius=4)) + # Store layer layer_comp.save( mstr_datafolder + "_cache\\" + str(self._latitude) + "-" + str(self._lat_number) + "_" + str(self._longitude) + "-" + str(self._lng_number) + "_" + self._tag + "-" + self._value + "_layer.png" ) mstr_msg("mstr_layergen", "Layer image finalized and saved.") - - diff --git a/maskgen.py b/maskgen.py index 5375d77..c661d19 100644 --- a/maskgen.py +++ b/maskgen.py @@ -182,4 +182,3 @@ class mstr_maskgen: mask_img.save(mstr_datafolder + "_cache\\" + fstr + "_" + self._tag + "-" + self._value + ".png") # Inform mstr_msg("mstr_maskgen", "Mask built.") - \ No newline at end of file