diff --git a/world_maker/data/building_moutain.png b/world_maker/data/building_moutain.png index aa920ae..7ce6301 100644 Binary files a/world_maker/data/building_moutain.png and b/world_maker/data/building_moutain.png differ diff --git a/world_maker/data/city_map.png b/world_maker/data/city_map.png index 16d5ffa..f7de44e 100644 Binary files a/world_maker/data/city_map.png and b/world_maker/data/city_map.png differ diff --git a/world_maker/data/district.png b/world_maker/data/district.png index fcc6821..373ac1c 100644 Binary files a/world_maker/data/district.png and b/world_maker/data/district.png differ diff --git a/world_maker/data/heightmap.png b/world_maker/data/heightmap.png index 70cc3a6..a930684 100644 Binary files a/world_maker/data/heightmap.png and b/world_maker/data/heightmap.png differ diff --git a/world_maker/data/heightmap_smooth.png b/world_maker/data/heightmap_smooth.png index 1282d61..4fd0e16 100644 Binary files a/world_maker/data/heightmap_smooth.png and b/world_maker/data/heightmap_smooth.png differ diff --git a/world_maker/data/heightmap_with_building.png b/world_maker/data/heightmap_with_building.png index bab97c0..6047f15 100644 Binary files a/world_maker/data/heightmap_with_building.png and b/world_maker/data/heightmap_with_building.png differ diff --git a/world_maker/data/highwaymap.png b/world_maker/data/highwaymap.png index 896f10b..9de071a 100644 Binary files a/world_maker/data/highwaymap.png and b/world_maker/data/highwaymap.png differ diff --git a/world_maker/data/mountain_map.png b/world_maker/data/mountain_map.png index 3ef750a..eddd5c6 100644 Binary files a/world_maker/data/mountain_map.png and b/world_maker/data/mountain_map.png differ diff --git a/world_maker/data/removed_treesmap.png b/world_maker/data/removed_treesmap.png index dabd1f7..fd47f44 100644 Binary files a/world_maker/data/removed_treesmap.png and b/world_maker/data/removed_treesmap.png differ diff --git a/world_maker/data/skeleton_highway.png b/world_maker/data/skeleton_highway.png index 13a1ae8..47e4a0f 100644 Binary files a/world_maker/data/skeleton_highway.png and b/world_maker/data/skeleton_highway.png differ diff --git a/world_maker/data/skeleton_mountain.png b/world_maker/data/skeleton_mountain.png index dcdcf2b..2f6dae7 100644 Binary files a/world_maker/data/skeleton_mountain.png and b/world_maker/data/skeleton_mountain.png differ diff --git a/world_maker/data/skeleton_mountain_area.png b/world_maker/data/skeleton_mountain_area.png index 5a025e6..897aa4e 100644 Binary files a/world_maker/data/skeleton_mountain_area.png and b/world_maker/data/skeleton_mountain_area.png differ diff --git a/world_maker/data/smooth_sobel_watermap.png b/world_maker/data/smooth_sobel_watermap.png index 2027431..a77c512 100644 Binary files a/world_maker/data/smooth_sobel_watermap.png and b/world_maker/data/smooth_sobel_watermap.png differ diff --git a/world_maker/data/smooth_terrain_delta.png b/world_maker/data/smooth_terrain_delta.png index dfd1969..d340356 100644 Binary files a/world_maker/data/smooth_terrain_delta.png and b/world_maker/data/smooth_terrain_delta.png differ diff --git a/world_maker/data/sobelmap.png b/world_maker/data/sobelmap.png index 1d9ca7a..bb46c81 100644 Binary files a/world_maker/data/sobelmap.png and b/world_maker/data/sobelmap.png differ diff --git a/world_maker/data/treemap.png b/world_maker/data/treemap.png index 7bd52e0..4031052 100644 Binary files a/world_maker/data/treemap.png and b/world_maker/data/treemap.png differ diff --git a/world_maker/data/watermap.png b/world_maker/data/watermap.png index abac2de..bdb1901 100644 Binary files a/world_maker/data/watermap.png and b/world_maker/data/watermap.png differ diff --git a/world_maker/terraforming.py b/world_maker/terraforming.py index 72ff6e2..deece8d 100644 --- a/world_maker/terraforming.py +++ b/world_maker/terraforming.py @@ -23,7 +23,7 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask treesmap = handle_import_image(treesmap).convert('L') mask = handle_import_image(mask) - removed_treesmap = Image.new("RGB", distance, 0) + removed_treesmap = Image.new("L", distance, 0) removed = [] for x in range(0, distance[0]): @@ -31,16 +31,15 @@ def remove_trees(heightmap: Union[str, Image], treesmap: Union[str, Image], mask if mask.getpixel((x, z)) != 0 and treesmap.getpixel((x, z)) > 0 and (x, z) not in removed: - treeArea = morphology.flood(treesmap, (z, x), tolerance=1) - blend = Image.blend(Image.fromarray(treeArea).convert( - 'RGB'), removed_treesmap.convert('RGB'), 0.5) + tree_area = morphology.flood(treesmap, (z, x), tolerance=1) + blend = Image.blend(Image.fromarray(tree_area).convert( + 'L'), removed_treesmap.convert('L'), 0.5) array = np.array(blend.convert('L')) bool_array = array > 1 removed_treesmap = Image.fromarray(bool_array) removed.append((x, z)) - print(x, z) for x in range(0, distance[0]): for z in range(0, distance[1]): diff --git a/world_maker/world_maker.py b/world_maker/world_maker.py index e393c3e..4c4c17b 100644 --- a/world_maker/world_maker.py +++ b/world_maker/world_maker.py @@ -46,22 +46,20 @@ def world_maker(): rectangle_mountain = rectangle_2D_to_3D(rectangle_mountain) # Terraforming + # Smooth initialization overide_map('./world_maker/data/heightmap.png', './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') overide_map('./world_maker/data/heightmap_with_building.png', './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') filter_smooth( './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') - overide_map('./world_maker/data/heightmap_with_building.png', - './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') - overide_map('./world_maker/data/heightmap_with_building.png', - './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') - filter_smooth( - './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') - overide_map('./world_maker/data/heightmap_with_building.png', - './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') - overide_map('./world_maker/data/heightmap_with_building.png', - './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') - filter_smooth( - './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') + + for i in range(5): + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building_moutain.png').save('./world_maker/data/heightmap_with_building.png') + overide_map('./world_maker/data/heightmap_with_building.png', + './world_maker/data/building.png').save('./world_maker/data/heightmap_with_building.png') + filter_smooth( + './world_maker/data/heightmap_with_building.png', 2).save('./world_maker/data/heightmap_smooth.png') + return rectangle_mountain, rectangle_building, skeleton_highway, skeleton_mountain, road_grid