Skip to content

Commit

Permalink
Water planes generation, water depth option for DEM
Browse files Browse the repository at this point in the history
* Textures and schema update for FS25.

* Safely fit polygon to the bounds.

* Water planes generation.

* Water Planes tutorial.

* README update.

* README update.

* README update.

* README update.

* README update.
  • Loading branch information
iwatkot authored Dec 24, 2024
1 parent 0a15a72 commit 409495c
Show file tree
Hide file tree
Showing 9 changed files with 342 additions and 34 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
🌽 Automatically generates farmlands 🆕<br>
🌿 Automatically generates decorative foliage 🆕<br>
🌲 Automatically generates forests 🆕<br>
🌊 Automatically generates water planes 🆕<br>
🌍 Based on real-world data from OpenStreetMap<br>
🏞️ Generates height map using SRTM dataset<br>
📦 Provides a ready-to-use map template for the Giants Editor<br>
Expand All @@ -65,6 +66,8 @@
🌿 Automatically generates decorative foliage.<br><br>
<img src="https://github.com/user-attachments/assets/27a5e541-a9f5-4504-b8d2-64aae9fb3e52"><br>
🌲 Automatically generates forests.<br><br>
<img src="https://github.com/user-attachments/assets/cce7d4e0-cba2-4dd2-b22d-03137fb2e860"><br>
🌊 Automatically generates water planes.<br><br>
<img src="https://github.com/user-attachments/assets/80e5923c-22c7-4dc0-8906-680902511f3a"><br>
🗒️ True-to-life blueprints for fast and precise modding.<br><br>
<img width="480" src="https://github.com/user-attachments/assets/1a8802d2-6a3b-4bfa-af2b-7c09478e199b"><br>
Expand All @@ -76,6 +79,9 @@
<a href="https://www.youtube.com/watch?v=Nl_aqXJ5nAk" target="_blank"><img src="https://github.com/user-attachments/assets/4845e030-0e73-47ab-a5a3-430308913060"/></a>
<p align="center"><i>How to Generate a Map for Farming Simulator 25 and 22 from a real place using maps4FS.</i></p>

![Map example](https://github.com/user-attachments/assets/c46a3581-dd17-462f-b815-e36d4f724947)
<p align="center"><i>Map example generated with maps4fs.</i></p>

## Quick Start
There are several ways to use the tool. You obviously need the **first one**, but you can choose any of the others depending on your needs.<br>
### 🚜 For most users
Expand Down Expand Up @@ -451,6 +457,8 @@ You can also apply some advanced settings to the map generation process. Note th

- Plateau height: this value will be added to each pixel of the DEM image, making it "higher". It's useful when you want to add some negative heights on the map, that appear to be in a "low" place. By default, it's set to 0.

- Water depth: this value will be subtracted from each pixel of the DEM image, where water resources are located. Pay attention that it's not in meters, instead it in the pixel value of DEM, which is 16 bit image with possible values from 0 to 65535. When this value is set, the same value will be added to the plateau setting to avoid negative heights.

### Texture Advanced settings

- Fields padding - this value (in meters) will be applied to each field, making it smaller. It's useful when the fields are too close to each other and you want to make them smaller. By default, it's set to 0.
Expand Down
8 changes: 5 additions & 3 deletions data/fs25-texture-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
{
"name": "mudDark",
"count": 2,
"tags": { "landuse": "farmland" },
"tags": { "landuse": ["farmland", "meadow"] },
"color": [47, 107, 85],
"priority": 4,
"info_layer": "fields"
Expand Down Expand Up @@ -171,7 +171,8 @@
"count": 2,
"tags": { "waterway": ["ditch", "drain"] },
"width": 2,
"color": [33, 67, 101]
"color": [33, 67, 101],
"background": true
},
{
"name": "mudTracks",
Expand Down Expand Up @@ -210,6 +211,7 @@
"landuse": "basin"
},
"width": 10,
"color": [255, 20, 20]
"color": [255, 20, 20],
"background": true
}
]
4 changes: 0 additions & 4 deletions data/fs25-tree-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,6 @@
"name": "tiliaAmurensis_stage04",
"reference_id": 1081
},
{
"name": "transportTree",
"reference_id": 1082
},
{
"name": "treesRavaged",
"reference_id": 1083
Expand Down
82 changes: 82 additions & 0 deletions docs/create_water_planes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
## How to create water planes

The generator will automatically generates the obj files for the water planes, but you need to process them both in Blender and in Giants Editor for them to look correctly in the game.

1. Find the obj file in the `water` directory.
2. Import the obj file in Blender.

![Import obj file in Blender](https://github.com/user-attachments/assets/c29c7187-2cd5-45b8-ad32-e6af85430c59)

3. Ensure that imported object selected, right click anywhere and select **Set Origin** -> **Origin to Geometry**.

![Set origin to geometry](https://github.com/user-attachments/assets/e2cf16af-5d42-449a-935a-524a70643f23)

4. Press the **N** key to open the **Transform** panel and set the **Location** to **0, 0, 0** and **Rotation** to **0, 0, 0**.
DO NOT TOUCH SCALE AND DIMENSIONS!

![Set location and rotation](https://github.com/user-attachments/assets/5489c013-2495-47c9-b422-d0d1d5b1ef9d)

5. Add an empty material to the object.

![Add empty material](https://github.com/user-attachments/assets/5923b99f-1483-4b34-98bd-4e32ba6fec5b)

6. Change the emission color to fully black.

![Emission](https://github.com/user-attachments/assets/3e3e028e-a3d8-40ce-8a00-9bc701147fbb)

![Black emission](https://github.com/user-attachments/assets/5687df82-6fe2-405d-af02-106d8c5e554b)

7. Apply the **Decimate** modifier to the object and **Shade Smooth**. You can find the example of this in the tutorial about [Background Terrain](https://github.com/iwatkot/maps4fs/blob/main/docs/create_background_terrain.md).

8. Open the **Giants Editor I3D Exporter** and set the path to the directory where the game is installed.

![Set path to the game directory](https://github.com/user-attachments/assets/971e1e13-235e-4ff3-83f1-a3f8af977c5f)

9. Go to the **Material** tab and press the **Detect Path** button.

![Detect path](https://github.com/user-attachments/assets/63fb3970-114b-4964-9032-c7ad00c5aa55)

10. Select shader **oceanShader.xml**.

![Select ocean shader](https://github.com/user-attachments/assets/8c6ddb13-cd0d-4726-96a6-4b3f2657cb57)

11. SAVE THE BLENDER FILE! Then press the **Apply** button.

![Apply](https://github.com/user-attachments/assets/4e5c53d8-73b7-4a25-b20a-b40d58477b1d)

12. Go to the **Export**, ensure that your object is selected and press the **Export selected** button.

![Export selected](https://github.com/user-attachments/assets/ba592c54-2d33-4e5b-9fe4-d03e49268d7d)

13. Open the Giants Editor and import the i3d file. It will be black, but don't worry, it's normal.
After it, position the water plane in the correct place.

![Position the water plane](https://github.com/user-attachments/assets/c7257060-bd83-498f-a5dc-098e675540df)

14. Open the **Material Editing** window and select your water plane.

15. Change the **Variation** to **simple** and then edit values as on the screenshot.
Those are default values for the water plane, but you can play with them to achieve the desired effect.

![Water plane values](https://github.com/user-attachments/assets/6624878c-818d-4371-bbf9-8bb6ace6589f)

16. Set **Smoothness** and **Metalness** to **1**.

17. Click on the button near the **Normal map**.

![Normal map](https://github.com/user-attachments/assets/95adc493-983a-46ae-bd20-7d1f4e998ba7)

18. Click on the **...** button and provide the path to the **water_normal.dds** file.
It's placed in `where-the-game-is-installed/data/maps/textures/shared/water_normal.dds`.

![Water normal map](https://github.com/user-attachments/assets/515de60b-bc1a-4843-b548-2820107435af)

19. You should see the normal map in the window. Press the **OK** button.

![Normal map window](https://github.com/user-attachments/assets/bee7955f-7f6c-4d94-978c-0ab7835b9e2b)

20. It should look like this.

![Water plane in GE](https://github.com/user-attachments/assets/b246cf85-b044-4ceb-bff4-9b32a753b143)

We're done here!
Loading

0 comments on commit 409495c

Please sign in to comment.