From 6bfec00846bcb47d393077e589df821ac954f22b Mon Sep 17 00:00:00 2001 From: "Marcus Str." Date: Sun, 2 Feb 2025 22:50:40 +0100 Subject: [PATCH] Final adjustment to forest and farmland rendering. --- layergen.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/layergen.py b/layergen.py index fe63047..fbcb227 100644 --- a/layergen.py +++ b/layergen.py @@ -420,6 +420,19 @@ class mstr_layergen: frst_pix[nx,ny] = nc frst_noise = frst_noise.filter(ImageFilter.GaussianBlur(radius=1)) layer.alpha_composite(frst_noise) + + # Same for farmlands... but not as intensive + if (self._tag == "landuse" and self._value == "farmland") or (self._tag == "landuse" and self._value == "farmyard"): + 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(25, 65) + 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") @@ -431,7 +444,7 @@ class mstr_layergen: self._tag == "natural" and self._value == "heath") or ( self._tag == "landuse" and self._value == "cemetery") or ( self._tag == "landuse" and self._value == "residential"): - amt = randrange(150, 301) + amt = randrange(50,101) masks = glob.glob(mstr_datafolder + "textures/tile/completion/*.png") patchtags = [ ["landuse", "meadow"], @@ -442,8 +455,8 @@ class mstr_layergen: for i in range(1, amt + 1): layerpatch = Image.open(mstr_datafolder + "textures/tile/completion_color/p" + str(randrange(1,14)) + ".png") if self._zoomlevel == 16: - lpw = int(layerpatch.width/4) - lph = int(layerpatch.height/4) + lpw = int(layerpatch.width/3) + lph = int(layerpatch.height/3) layerpatch = layerpatch.resize((lpw,lph), resample=Image.Resampling.BILINEAR) layerpatch = layerpatch.rotate(randrange(0, 360), expand=True) lx = randrange(0, mstr_photores-layerpatch.width)