Meadow is everywhere - and how it looks directly affects the overall look of the map - a good meadow can make a map feel bright, flowery or lucious. A meadow can connect fields, be in the median of roads, and overall is the "base" of the map.
There is a common occurrence with map makers where they will "paint" their map using crop grass which can cause issues with mowing, and overall look of the map. Since the game handles the two things (crop grass and meadow) differently, we're going to go in depth on how to customize those parts of the map (called Foliage Layers) to not only alleviate those issues, but also make your map stand out.
We'll finish off by showing an example on how to leverage the game's probability to make meadows that don't look so bland, and include things like bushes and sticks into the foliage layers.
Download and Unzip the map you'd like to edit. I would suggest that on the map that is being edited (the "goal" map) that you immediately rename the map folder to something like FS22_MapName_EDIT to make sure that you don't have any conflicts. Be aware that renaming the folder will require a new savegame.
We're going to work directly in your mod folder, using the unzipped folder we just renamed. To make sure that it doesn't cause conflicts with the original zip file, I'd suggest moving the original zip to a different location. If they are both in the same savegame folder, it'll be hard to tell which you are loading when you load up the game, and if they are both named the same - the game will always use the zip file over a normal folder.
Grass & Meadow are both considered Foliage Layers in the game, but are applied slightly differently. Meadow can be painted in-game using the "Plant" terrain tool, but Grass of course will need to be planted with a planter. Both Grass & Meadow can be painted using the Giants Editor (GE) anywhere on the map.
The many looks for grass between base game & mod maps
Left-Right: Elm Creek, Calmsden, Erlengrat, Middleburgh
The many looks for meadow between base game & mod maps
Left-Right: Elm Creek, Haut Beyleron, Erlengrat, Middleburgh
Both Grass & Meadow are also setup by default to have 4 growth stages, and both support rolling with a grass roller which is handled by the game using a ground texture change. Each growth stage will take a single game month assuming that the growth charts have not been modified. For the images below - we're using the example map, Calm Lands, which uses the same Grass as Elm Creek, but it's own modified Meadow.
(0) Rolled
(1) Invisible (Sown)
(2) Second Growth (Cannot Mow)
(3) Third Growth (Mow at 50% loss)
(4) Harvest Ready (100%)
(5) Freshly Mown
The biggest differences between Grass & Meadow is what the game does to the land when you mow - if you mow Grass that is not already a field (painted in GE), the game will automatically create a new field on that spot. If you mow a strip down the middle of a painted Grass area - you'll see a new field created in the map overlay the width of your mower.
From this point on, we'll be diving into code - you'll need a working knowledge of XML markup, as well as an understanding of GE and how to navigate a model's tree structure. All of the following content assumes the both, but we'll explain the details along the way in case you're new!
First find out how the map we're looking at renders meadow, and then dive in and open those files. We start with a little bit of research, and the same research will apply for any map. First, open the map's map.i3d file in a text editor (not GE). Since the i3d file format is essentially just an XML file, it'll look and read like XML. Once the file opens, search for the string "meadow". The first occurrence of the search results should look something like this. (If not, find a line that looks like this, the fileId may be different, and if your map already has a customized meadow the path may look entirely different)
Word of warning! You are now opening base game files - do not change or save these files while we are looking at them!
<File fileId="326" filename="$data/foliage/meadow/meadowFR.xml"/>
For Calm Lands, it appears that the map author chose to use the French meadow XML. That's great, so we can look in our $data directory for that file. On my machine, that file is here: C:\Program Files (x86)\Steam\steamapps\common\Farming Simulator 22\data\foliage\meadow\meadowFR.xml
<?xml version="1.0" encoding="utf-8"?>
<foliageType>
<foliageLayer cellSize="8" objectMask="16711935" decalLayer="0" densityMapChannelOffset="0" numDensityMapChannels="4" numBlocksPerUnit="2.5" shapeSource="meadowFR.i3d">
<foliageStateDefaults distanceMapLayer="1" width="1.0" height="1.0" widthVariance="0.25" heightVariance="0.25" horizontalPositionVariance="0.3" />
<!-- 1 0 0 0 - invisible -->
<foliageState name="invisible" />
<!-- 0 1 0 0 - green small -->
<foliageState name="green small" numBlocksPerUnit="3.2" />
<!-- 1 1 0 0 - green middle -->
<foliageState name="green middle" />
<!-- 0 0 1 0 - green big (harvest ready) -->
<foliageState name="harvest ready" widthVariance="0.5" heightVariance="0.5" />
<!-- 1 0 1 0 - cut -->
<foliageState name="cut" numBlocksPerUnit="3.2" />
<!-- -->
</foliageLayer>
</foliageType>
I've clipped out some of the detail of this file, but I've left in the part we want to talk about first. foliageState and variance.
We can read the foliage states as numbers, and the groups of 1's & 0's are a bitmask - when translated into something readable, those directly translate into growth states 1-5, as we discussed above.
<!-- 1 0 0 0 - (1) invisible -->
<!-- 0 1 0 0 - (2) green small -->
<!-- 1 1 0 0 - (3) green middle -->
<!-- 0 0 1 0 - (4) green big (harvest ready) -->
<!-- 1 0 1 0 - (5) cut -->
There are two ways to affect a foliage state, which controls the size of each block that gets rendered for the foliage in question. You can either change defaults (which applies to all states) or change individual states, which will only affect that state.
<foliageStateDefaults distanceMapLayer="1" width="1.0" height="1.0" widthVariance="0.25" heightVariance="0.25" horizontalPositionVariance="0.3" />
Each of the things in that block in the light blue is called a "property" and thing highlighted in orange (with the quotes) is a "value". In XML, every property must have a value. Every value must be in double quotes. "0.25" not '0.25' or 0.25. All of the properties here are the "defaults" that apply to all foliage states; You can also apply the same properties to each foliage state individually, which can have different effects.
Looking at those properties - we have a few values and variances that we can change, and each does something different to the rendered block.
width & height - This will change how wide and tall to render the i3d file in each block when it renders. If you set the height to 2.0, it'll render every foliage state stretched to be twice as tall. Width will do the same.
widthVariance - This will change how "wide" each block of the crop renders. A value "0.25" of means that it will render between the normal 1 block wide, "0.25" in either direction (sometimes wider, sometimes less wide). AFAIK, this affects the width of the model that gets put down in each block that can be rendered from a visual standpoint only. It won't make one block actually spill out into another block... but it might look like it does. This value is what primarily controls how "even" a pattern rendered looks. If there was no variance, every block would look the same width.
heightVariance - This will change how "tall" each block will render. This one is my favorite to adjust, especially for grass. If you look at the screenshots above - the Middleburgh grass has a height variance of "1.5", which is part of the reason why it looks so tall, while base-game grass has a height variance of "0.5". The height variance is the height difference from block to block to give the rendered foliage variation in heights - so it all doesn't render at the exact same height.
horizontalPositionVariance - this sets the offset from center that the block renders. This is what helps a pattern not look like it's growing in perfect rows. Personally, I don't change this one too much.
If we then look farther down the file, at the individual foliage states - we can see each of the above properties is not in every state - that's because we set the defaults in the foliageStateDefaults block, and for each state, we only need have a property / value pair if we want that value to be different than the default.
<foliageState name="harvest ready" widthVariance="0.5" heightVariance="0.5" />
For this foliage state (harvest ready), we're using all default values except for the width and height variances, which we want to be a bit more varied (ie: more differences in height and width from block to block)
Later on when we start editing the look of the meadow, this is one of the places where we will spend the most time.
Now, we open the i3d file in the Giants Editor. Make sure you are opening the right one - you want the file specified in shapeSource property of the foliage layer line of the foliage layer XML file.
<foliageLayer cellSize="8" objectMask="16711935" decalLayer="0" densityMapChannelOffset="0" numDensityMapChannels="4" numBlocksPerUnit="2.5" shapeSource="meadowFR.i3d">
So we open the meadowFR.i3d file in GE.
We're not going to edit this file right now, but just to look at what's there.
You'll see on the scenegraph on the left that we have grassPure (just grass), with the states that we've seen in the xml file, namely greenSmall, greenMiddle, harvestReady, and cut. Each one has a LOD0 (near render) and LOD1 (distance render), and as long as there is a one to one version of each name, it will render properly in the game. We're not going to be changing any of those, but just to relate the i3d to the XML. Let's look back at the XML for greenSmall.
<!-- 0 1 0 0 - green small -->
<foliageState name="green small" numBlocksPerUnit="3.2">
<foliageShape probability="0.7">
<foliageLod blockShape="0>0|0"/>
<foliageLod blockShape="0>1|0"/>
</foliageShape>
<foliageShape probability="0.3">
<foliageLod blockShape="6>0|0"/>
<foliageLod blockShape="6>1|0"/>
</foliageShape>
</foliageState>
The foliageShape block here specifies what from the i3d to render in each state, as well as the probability of that shape rendering. The two foliageLod lines for each specify the LOD0 and LOD1 versions of each shape that will render - which directly correlates to the Index Path as defined in the i3d file (from the attribute panel).
Deciphering the whole block above into something easier to understand is a bit tricky, but let's break down what will get rendered.
For each block, the game will render the grassPure > LOD0 > greenSmall ( 0>0|0 ) layer with a probability of 70%, and render grassPure > LOD1 > greenSmall ( 0>1|0 ) as the LOD1 version when the player is far away.
For each block, the game will render the grassClover > LOD0 > greenSmall ( 6>0|0 ) layer with a probability of 30%, and render grassClover > LOD1 > greenSmall ( 6>1|0 ) as the LOD1 version when the player is far away.
When rendering a single "unit" (a grouping of blocks), each "block" will run through the logic here 3.2 times and group all of that into a single "unit" that gets rendered.
When rendering each block, the default width, height, widthVariance, heightVariance, and horizontalPositionVariance will be used since we didn't specify any custom values for this foliage state - which means the scale will be "1.0" for both width & height, but have variances of "0.25" for both width and height
Which should all output 3 tufts of grass in a group or maybe 2 tufts of grass and one of clover, all with differing heights, and varied positions from center.
Does that all make sense?? I understand that it's a ton of info, but the reality of it is that the values here are all controlling how the foliage layer (meadow in our case) looks in the game, and controls how "random" it seems. We'll talk more about how to change these values when we start customizing in the next section.
On some maps (like Calm Lands) - the outside areas might look like Meadow, but may have "extra" stuff in it that doesn't grow back. This is because the author either used a technique like we're going to use here to make their own custom meadow foliage layer that they painted the whole map with, or used another technique (such as a foliage generator script) to generate all of the foliage on the map. In this photo, the area on the left was mowed and grew back, but what grew back is starkly different what was there (on the right)
The downside is that it doesn't grow back the way it looks in the first place, but depending on your use case, that may be a good thing or a bad thing. I'll explain both ways as we go along.
Enough info, let's start making something cool! First step is to setup our map to have it's own custom layer.
Matching the base game structure, we'll create a foliage folder somewhere inside our map folder. it can be at the base level, or inside the map folder - where it goes doesn't matter other than you'll need to know where it is. Then, create a meadow folder inside that. Save a copy of the meadowFR.xml file from the data directory (that we opened earlier) in that folder, as the meadowBrush.xml file. We'll edit those later. Your folder should look like this:
We're going to use GE to save a copy of the meadowFR.i3d file into our new folder. It's important to not try to copy this file over yourself from teh base game, because the i3d file has pointers to many of the base game assets (all the other files that are in the meadow folder in the data directory)... and we don't want to duplicate any of those files into our map as that just adds to the map's file size. To help keep our map optimized, we'll just keep using the files included in the basegame wherever possible.
Open the meadowFR.i3d file again in Giants Editor, and choose File > Save As.... then choose the folder we just created as the location.
Open the meadowFR.i3d file again in Giants Editor, and choose File > Save As.... then choose the folder we just created as the location.
The reason we do this is that GE will save into the new location, but maintain the file paths to the original assets in the base game data directory.
GE will save two files - the new meadowFR.i3d file (which you can name anything you want, but we're going to leave it as is for the example) and a second file with the same name, but a different extension. In our case, this file will be meadowFR.shapes
You should be left with a folder that looks like this:
Back in our map, we're going to open the file map.i3d again, and find the meadow file line that we found before.
<File fileId="326" filename="$data/foliage/meadow/meadowFR.xml"/>
This time, we're going to update it to match the path to the new foliage xml that we just created. In our case, that will be "../foliage/meadowFR.xml" this is using the ../ because the path to our i3d file is FS22_CalmLands/maps/map.i3d and the path to our foliage is FS22_CalmLands/foliage/meadow/meadowFR.xml.
<File fileId="326" filename="../foliage/meadow/meadowFR.xml"/>
Now if we loaded our map up in GE or in-game, we won't see any difference since it's just loading a copy of the same file from a different place, but it doesn't hurt to check, right? Feel free to check now. If you are having an issue with files not loading, please check your path and realize that the path to the meadowFR.xml file is relative to the map.i3d file.