Overview
Vineyards now follow the terrain. On a slope the rows run down the fall line and every vine group lies pitched and rolled on the ground instead of standing level. Each row is filled up to the parcel's edge, its roads, paths and buildings. That removes the stairs and open triangles the 15.9 m groups left along slanted edges and roads. The approach is ported from World-to-BeamNG's vineyard generator (I'm its author), adapted to BeamNG.Earth's streamed tiles and its three-row grape_vine_group.
Overlaps with #1424 in vineyard_items: the two complement each other (that PR adds French parcels, this one lays out every vineyard). I'm happy to rebase on top of it if it lands first.
Closes #1498.
Before / after at Laufen (Baden-Württemberg):
before (BeamNG.Earth 1.10.1-beta)
after:
Changes
- Row direction (
vegetation._row_axis,_fall_axis):- Where a field's mean slope is 2 % or more (
VINE_FALL_MIN), the rows follow its fall line. It comes from the structure tensor of the DEM's gradients, which gives one axis even over a crest, where the mean gradient cancels. - Otherwise the rows keep to the field's dominant edge (
_edge_axis): on flat ground, without heights, or where that edge is within 15° of the fall line (VINE_SNAP_DEG). - Heights come from the DEM at
ROCK_SLOPE_ZOOM. A cell whose DEM could not answer is not kept, as for the slope rocks.
- Where a field's mean slope is 2 % or more (
- Lying on the slope (
_vine_tilt):- Each vine group's pitch comes from the graded ground at its two ends, its roll from the ground under its outer rows. Both are capped at 30°. Laid level, a group's ends stood about 0.8 m clear of a 10 % slope or sank into it.
- Single rows pitch without rolling.
- Only tiles that contain vines carry the two extra numbers per row (pitch, roll), so their stride is 10 (
TILT_STRIDE). Every other tile is unchanged. - The native module's rows are extended as text, so earthfast is untouched.
- An older mod reads the stride and skips the extra numbers: its vines stay level, as before.
- Filled up to edges and roads (
_row_fill, new groupvine_row: Italy's single-rowgrape_vine, 5.5 m):- Every row of the field (2.45 m apart, in line with the groups' rows) is sampled every 0.25 m. Its stretches inside the field, off its holes, off the canopy grid's blocked pixels (roads, paths, buildings, water) and not under a group are filled end to end. The segment count is rounded up and the segments sit flush with both ends.
- A stretch shorter than a segment next to a group takes one segment set flush with its free end, which reaches into the group's row where the overlap doesn't show.
- A field too narrow for a group gets single rows only. Until now it got no vines at all.
- Groups:
- All three rows must now be inside the field and free at their middle and both ends. Until now only the middle row was checked, so an outer row could stand up to 2.45 m outside the parcel or on a road running along the rows.
- On a slope the lattice spacing is the groups' length times the cosine of the rows' slope along the field (90th percentile,
_row_cos). Groups overlap by 0.1 m (VINE_JOIN_M): the mesh runs from -7.96 to +7.88 m and every other group is turned round. At 15.9 m spacing every joint opened on a slope (0.7 m at 30 %).
- Mod (
trees.lua):- A row of a stride-10 tile with a pitch or roll gets its basis from
tiltBasis(orthonormal, right-handed, from the server's yaw). It goes through the guardrails' column path and is turned by a geotile's placement. - New
CATALOG.vine_row, visible as far as the groups.
- A row of a stride-10 tile with a pitch or roll gets its basis from
vegetation.VERSION29 → 30: cells are rebuilt once.
Cost: the single rows add items along parcel edges. On a 1 ha test field there were about three times the items of the groups alone. Large, regular parcels add proportionally less. VINE_CELL_MAX is unchanged.
Files
server/vegetation.pyserver/tests/test_vegetation.pymod/beamng_earth/lua/ge/extensions/beamngEarth/trees.luamod/tests/test_trees.lua
Validation
test_vegetation:- Rows down a 10 % slope; along the edge on flat or gentle ground and without a DEM; kept to an edge near the fall line; one axis over a crest.
- Pitch and roll on the slope, capped.
- Stride-10 rows and file; the spliced JSON is identical to
json.dumpsof the rows; a tile without vines stays stride 8. - Rows closed up to slanted edges and to a road, with no gap over 0.6 m and nothing past the edge or on the road.
- Single rows only in a narrow strip.
- Groups spaced by their run on a 30 % slope.
test_trees:tiltBasis; a stride-10 tile (tilted vine by its columns, level items by yaw as before);vine_rowresolves to Italy'sgrape_vineat scale 1.- Existing suites pass on
dev:test_vegetation,test_fast,test_geotiles,test_determinism,test_blockworker,test_guardrails(149 passed, 1 skipped), and all 141 mod test files (rebased ondev64cef6a4). - In game (Windows 11, BeamNG.drive 0.40.5): sloped and flat vineyards, rows down the slope and lying on the ground, filled up to parcel edges and roads, no gaps between groups.
🤖 Generated with Claude Code