...nodeId="5125" heightMapId="1" patchSize="65"
This line, part of the TerrainTransformGroup tag, has patchSize set to 65. Why is this so?
Let’s ask Microsoft Copilot about that. The AI companion will also explain some other parameters.
Let’s break down each parameter in that line from your mapEU.i3d
file and see what it tells us about how the terrain is set up:
patchSize="65"
This value determines the size of each terrain patch—the basic unit into which the overall terrain is divided. A patch size of 65 means the terrain is subdivided into relatively small segments. Smaller patches can offer more precise editing and detailed LOD transitions, but they also require more processing during real-time editing in Giants Editor. Essentially, with a patch size of 65, you’re opting for a good balance between control and performance when shaping your map.maxLODDistance="750"
ThemaxLODDistance
parameter sets the distance (in game units) up to which a particular level-of-detail (LOD) is maintained for the terrain. A value of 750 indicates that up to 750 units away from the camera, the terrain uses a higher or more detailed LOD. Beyond that, the game will switch to a less detailed version to optimize rendering performance. This threshold helps ensure that detailed terrain is visible near the player while distant terrain, which doesn’t need as much detail, is rendered more efficiently.heightScale="255"
TheheightScale
parameter is used to convert the raw grayscale values from your heightmap into actual terrain heights. In many cases, heightmaps store elevation data in a normalized range (like 0 to 1), and multiplying by 255 scales those values to fit your desired elevation range. Here, a heightScale of 255 means the maximum elevation difference on your map will be 255 units. This is a typical setup for maps that use 8-bit height data.unitsPerPixel="1"
This setting defines the horizontal scale of your terrain. It tells the engine that every pixel from your heightmap corresponds to one unit in the game world. Essentially, it sets the resolution of your terrain in the horizontal plane. WithunitsPerPixel
equal to 1, the map maintains a one-to-one correspondence, which is important for ensuring that the terrain details line up correctly with the game’s coordinate system.
In Summary
- Precision vs. Performance:
A patch size of 65 gives you a high level of detail for editing but can be more demanding during real-time terrain modifications. Meanwhile, amaxLODDistance
of 750 helps balance high-detail rendering nearby and performance-friendly, lower detail further away. - Elevation and Scale:
TheheightScale
of 255 ensures that your heightmap values are converted into a realistic range of elevations. TheunitsPerPixel
value of 1 ensures that your map’s scale is consistent and true to the original heightmap’s resolution.
This combination of settings is chosen to strike a balance between visual fidelity, precise editing control in Giants Editor, and runtime performance in the game. They ensure that your terrain can be manipulated in detail during the modding process while still performing efficiently when rendered in-game.
Why not a patch size of 85?
During some testing with GIANTS Editor 10.0.3 adding different patch size values into the mapEU.i3d, the editor usually responded with a CTD – crash to desktop. I tried values between 55 and 85, and the response was the same.
Later on I checked the editor_log.txt and found this particular line of info:
New Terrain (geometry quadtree) max resolution 16384; max tile size 64
So, one may wonder if the patchSize is hardcoded. Anyway, Microsoft Copilot was connecting some dots, and here’s the connection:
Patch size and tile size in Giants Editor are directly related—but they’re not exactly the same thing. Here’s how they connect:
- Tile Size:
When the editor log says “max tile size 64,” it refers to the number of terrain cells (or tiles) along one edge of a terrain patch. Essentially, the system divides the terrain into a grid where each cell represents one tile. - Patch Size:
A terrain patch, however, is defined by its vertices. In a grid with 64 tiles (cells) along an edge, you’ll need 65 vertices to outline those cells. That’s why you typically see a patch size of 65 in the files—meaning there are 65 points (or vertices) per side.
In summary:
The tile size refers to the number of cells, while the patch size refers to the number of vertices, which is one more than the tile count. With a max tile size of 64, the corresponding patch size naturally becomes 65. This relationship is hardcoded into the terrain system via the geometry quadtree setup, ensuring consistency in how the terrain is processed and rendered in the editor.
Continuing from that I also wanted to know about that above in relation to this one:
New Terrain (compressed heightmap) resolution 4096; tile size 128
The AI companion responded:
Both lines are part of the overall terrain pipeline in Giants Editor, but they refer to different stages or representations of the terrain data. Let’s break down the connection:
- Geometry Quadtree vs. Compressed Heightmap:
- The line
New Terrain (geometry quadtree) max resolution 16384; max tile size 64
refers to the geometry quadtree. This structure handles the rendering details and Level of Detail for the terrain. A max tile size of 64 here means that each patch is subdivided into 64-tile cells (resulting in 65 vertices per side), which the system uses to manage and cull terrain geometry at high resolutions (up to 16,384 units). - The next line
New Terrain (compressed heightmap) resolution 4096; tile size 128
is about the compressed heightmap. This is a lower-resolution version of the terrain’s elevation data that is often used for storage, collision calculations, or quickly sampling large-scale elevation without loading the full high-resolution mesh. Here, the terrain’s height data is stored at a 4096 resolution, with each tile spanning 128 units of the heightmap grid.
- Connecting Tile Size and Patch Size Concepts:
- In the geometry quadtree part, a “tile size” of 64 relates directly to the concept of a patch size: a grid with 64 tiles along an edge requires 65 vertices (i.e., patchSize = tileSize + 1). This is why you see patch sizes normally hardcoded at 65.
- For the compressed heightmap, the “tile size” of 128 doesn’t directly translate to the vertex grid used for detailed rendering. Instead, it defines how the elevation data is chunked or compressed for purposes where high fidelity is less critical, or where performance and memory usage are prioritized.
- Why the Difference?
The differences in resolution and tile sizes reflect the balance between detail and performance at different stages of the terrain system. The geometry quadtree is optimized for real‑time rendering with high-resolution detail (hence the smaller tile sizes and larger overall resolution), while the compressed heightmap is optimized for storage and efficiency, using coarser tiles.
In short, both lines relate to the overall tiling system of the terrain, but they serve different functions. One handles the high-detail, real‑time geometry and is tightly coupled to the patch/vertex grid (64 cells, 65 vertices), while the compressed heightmap uses a different tiling (tile size 128) and lower resolution (4096) for an optimized, compressed form of the terrain’s elevation data.
Patch Size and Units per pixel in relation
Later, I responded: “Okay, good. I see the difference. In my experience, units per pixel seem to make a farming simulator map larger, but then again, with a patch size of 65.”
Microsoft Copilot wanted to clarify this with the following response:
You’re absolutely right—units per pixel and patchSize serve different roles that can affect your map’s overall footprint.
- Units per Pixel:
This parameter dictates how much game world distance one pixel from your heightmap represents. For example, if you have a heightmap of a certain resolution, increasing the units per pixel will expand the terrain’s physical dimensions. So, if you set a higher units per pixel (say, from 1 to 2), the entire map will become larger because every bit of elevation data now covers twice the distance in the world. - Patch Size:
The patchSize, which in Farming Simulator is hardcoded to 65, refers to the grid of vertices used to divide the terrain into manageable pieces. A patch with 65 vertices per edge implies that there are 64 cells (or “tiles”) per patch. This number is fixed—ensuring consistency in how the terrain is rendered and processed by the engine.
Connecting the Two:
Even though the patchSize (65 vertices) remains constant, the actual physical footprint of each patch in the game world is determined by the units per pixel setting. For instance, with units per pixel set to 1, a patch covers 64 game units (because there are 64 cells). If you increase units per pixel, each cell now spans more units, ultimately enlarging the patch—and therefore the whole map—even though the underlying vertex grid remains 65.
In short, units per pixel scales your map’s size in-world, while the patch size defines the resolution or density of the terrain mesh. That’s why, in your experience, a higher units per pixel value makes the map appear larger, even though the patchSize remains at 65.