]> marstr Code Repo - marstr/orthographic.git/commitdiff
Adjusted forest rendering to make those appear a bit more realistic, while retaining...
authorMarcus Str. <marcus@marstr.online>
Sun, 2 Feb 2025 19:43:28 +0000 (20:43 +0100)
committerMarcus Str. <marcus@marstr.online>
Sun, 2 Feb 2025 19:43:28 +0000 (20:43 +0100)
layergen.py
photogen.py

index f78a7fb26e628e94bdd34a1a6b229de7dde587e4..fe6304767cfd9bb0aaf7fb568467009dd9c0e02d 100644 (file)
@@ -407,6 +407,20 @@ class mstr_layergen:
                 tmp_layer.putalpha(51)\r
             \r
             layer.alpha_composite(tmp_layer)\r
+\r
+            # Let's make some noise to give forests some better look\r
+            if (self._tag == "landuse" and self._value == "forest") or (self._tag == "leisure" and self._value == "nature_reserve"):\r
+                frst_noise = Image.new("RGBA", (self._imgsize, self._imgsize))\r
+                frst_pix = frst_noise.load()\r
+                for n in range(0, 1500000):\r
+                    nx = randrange(0, self._imgsize)\r
+                    ny = randrange(0, self._imgsize)\r
+                    na = randrange(65, 241)\r
+                    nc = (0,0,0,na)\r
+                    frst_pix[nx,ny] = nc\r
+                frst_noise = frst_noise.filter(ImageFilter.GaussianBlur(radius=1))\r
+                layer.alpha_composite(frst_noise)\r
+\r
             mstr_msg("layergen", "Layer image generated")\r
             \r
             #---------------------------------------------\r
index 3792f4ae60462209e1863dbcb90e50045ad48624..5f0c15de997b88854672b0b21185628b52923850 100644 (file)
@@ -532,7 +532,7 @@ class mstr_photogen:
         # Let's see if we can correct that\r
 \r
         # These files will need to be generated after manual check of the orthos\r
-        if os.path.isfile(mstr_datafolder + "z_orthographic/data" + self._latlngfld + "/water/" + str(self._ty) + "_" + str(self._tx)) == True:\r
+        if os.path.isfile(mstr_datafolder + "z_orthographic/data/" + self._latlngfld + "/water/" + str(self._ty) + "_" + str(self._tx)) == True:\r
             # natural:water\r
             ntrl_water = False\r
             ntrl_idx = 0\r