Skip to content

Commit

Permalink
Number of plants islands.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jan 7, 2025
1 parent d7d954c commit 1afa5a7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,18 @@ decimation will be, which means the higher it will affect the geometry. It's not

- Add Farmyards - if enabled, the tool will create farmlands from the regions that are marked as farmyards in the OSM data. Those farmlands will not have fields and also will not be drawn on textures. By default, it's turned off.

- Base grass - you can select which plant will be used as a base grass on the map.

- Plants island minimum size - when random plants are enabled, the generator will add islands of differents plants to the map and choose the random size of those island between the minimum and maximum values. This one is the minimum size of the island in meters.

- Plants island maximum size - it's the same as above, but for the maximum size of the island in meters.

- Plants island vertex count - the number of vertices in the island. The higher the value, the more detailed the island will be. Note, that high values will turn the smoothed island into geometric madness.

- Plants insland rounding radius - used to round the vertices of the island. The higher the value, the more rounded the island will be.

- Plants island percent - defines the relation between the map size and the number of islands of plants. For example, if set to 100% for map size of 2048 will be added 2048 islands of plants.

### I3D Advanced settings

- Forest density - the density of the forest in meters. The lower the value, the lower the distance between the trees, which makes the forest denser. Note, that low values will lead to enormous number of trees, which may cause the Giants Editor to crash or lead to performance issues. By default, it's set to 10.
Expand Down
4 changes: 2 additions & 2 deletions maps4fs/generator/grle.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,11 @@ def get_rounded_polygon(
grass_image_copy[grass_image != 0] = base_layer_pixel_value

# Add islands of plants to the base image.
island_count = self.map_size
island_count = int(self.map_size * self.map.grle_settings.plants_island_percent // 100)
self.logger.debug("Adding %s islands of plants to the base image.", island_count)
if self.map.grle_settings.random_plants:
grass_image_copy = create_island_of_plants(grass_image_copy, island_count)
self.logger.debug("Islands of plants added to the base image.")
self.logger.info("Added %s islands of plants to the base image.", island_count)

# Sligtly reduce the size of the grass_image, that we'll use as mask.
kernel = np.ones((3, 3), np.uint8)
Expand Down
1 change: 1 addition & 0 deletions maps4fs/generator/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class GRLESettings(SettingsModel):
plants_island_maximum_size: int = 200
plants_island_vertex_count: int = 30
plants_island_rounding_radius: int = 15
plants_island_percent: int = 100


class I3DSettings(SettingsModel):
Expand Down
5 changes: 5 additions & 0 deletions webui/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ class Settings:
"Plants island rounding radius value is used to set the rounding radius of the plants. "
"The higher the value, the more rounded the vertices will be. "
)
PLANTS_ISLAND_PERCENT = (
"Plants island percent value is used to set the relation between the map size and the "
"number of islands of plants. For example, if set to 100% for map size of 2048, the number"
" of islands will be 2048."
)

# I3D Settings

Expand Down

0 comments on commit 1afa5a7

Please sign in to comment.