WIP: feat(vk): Grass distance, how far the grass stays full (2x by default) #1382

Draft
winterelfeas wants to merge 2 commits from winterelfeas/Longshot:grass-distance into main
First-time contributor

Type: feat · Risk: low · Tested on: Windows 11, RTX 5090 (NVIDIA 621.01) · Needs: AMD, Intel; Steam Deck

Why

Kokiri Forest's short grass blades and the moss on its stones stop about 20 m from the camera. From the stepping stones the ground in front of the forest's exit looks bare, and the blades only grow in as Link walks up to it. Hyrule Field's grass is full only within 8 m of the camera and thins out quickly beyond, so the field looks barren in the middle distance. Players asked for more grass draw distance in #950 and #205. See #950, #205.

What changed

A new Graphics row, Grass distance (Game's, 2x, 3x, 4x; 2x by default), makes the short blades reach that many times as far and keeps Hyrule Field's grass full that many times as far. It changes only the copy of a few uniform values the GPU reads, never the game's memory. The short blades change at once; the field's grass as the game makes its ground tiles (Link moving on, the area loading).

Why three values in three programs: the game draws the blades from patches that the compute program 383a566958350efe picks around Link (word 75 of its scene buffer: a 22 m radius). Each blade then goes through a random cut by its distance in the task stage of both programs that draw it, 43ec86f35fd937b9 (the colour) and 8a8304edb7bdf4bf (a second pass over the same blades); words 46 and 47 of their scene buffer make a fade from 12 m to about 20 m. Lifting the cut in only one of the two passes changes nothing on screen, which is why this took a while to find.

The main grass (Hyrule Field's): compute d5a9475f2790532e gives each ground tile a blade count of the density times 1 - (1 + w97 - w96/d²): full to √w96 (8 m), then falling as 1/d² to none at √(w96/w97) (65 m). The game's own foliage setting for it (the foliage object's +0x7c) moves both words together; the row multiplies both by n², so the full count reaches n times as far and the end stays at 65 m.

  • vk: grass_reach() and grass_words() in gpu/vk/vk_draw.cpp; uniform_range() copies a binding c3 of those three programs into the stream and scales the words (radius times n, both fade ends divided by n). Only positive values are changed: the same slot holds other numbers in other stages. draw() and dispatch() tell uniform_range() the program (ub_prog_key). d5a9475f2790532e's words 96 and 97 times n². Each changed word is logged once: vk: Grass distance 2x: program ... word ... a -> b.
  • menu: the row in gpu/vk/vk_menu.cpp (tx_grass_distance), opts.grass_distance in gpu/vk/vk_menu.h; no Quality preset sets it (preset-exempt, as Anisotropic filtering).
  • switch: RX_VK_GRASS_DISTANCE=<n> (1 to 8) over the row for one run, in gpu/vk/switches.def.
  • docs: README option table and Graphics notes; grass_distance in docs/development.md's options file table.
  • tests: tests/test_grass_distance.py keeps the row, its labels and the reach table in step, and names the three programs.

Measurements

Verdict: helps: from Kokiri's stepping stones the blades reach the ground before the exit, and Hyrule Field's grass stays full further out (30 to 48 % more blades in the middle distance at 3x, as the game's own foliage setting gives); the short blades' area in the upper half of the frame goes from about 1300 px (Game's) to 3650 px (2x) and 4400 px (4x), and the GPU frame grows by 0.19 ms at 2x, 0.42 ms at 4x in Kokiri Forest and about 0.35 ms at 4x in Hyrule Field, 2x there within the noise (RTX 5090, 2560x1440).

Hardware: Windows 11, RTX 5090, NVIDIA 621.01, 32 threads
Scene: Kokiri Forest, the save's start walked to the stepping stones (1.1, 3.25), the camera tilted up a little to show the ground before the exit; output 2560x1440, DLSS, no frame generation, 60 fps cap
Method: GPU time: RX_VK_PASS_TIMING=1 (the "ms a frame in all" line, every 600 presents), one run, the row changed live through the control bridge in the order Game's, 4x, 2x, 3x, Game's, 4x, 2x, 3x, 25 s each; the median of the blocks that lie wholly inside each value's time. Blade area: a debug build that skips 43ec86f35fd937b9's draws (the blades then show white where the second pass drew them), two shots per value, white pixels in the upper half.
Baseline: this PR at Game's, which leaves the three values as main has them, in the same run, so the row can be switched live and the values interleaved (main has no row to switch). The blade counts come from the debug build with the same values set through a uniform patch switch.
The Kokiri Forest numbers were taken on ed84459d, the first commit; 095a6434 adds the main grass and leaves the short blades' code as it was.
How to reproduce: Kokiri Forest, stand on the stepping stones looking at the exit, switch Grass distance between Game's and 4x.

Before, Game's: this PR @ 095a6434 After, 2x: this PR @ 095a6434 After, 3x: this PR @ 095a6434 After, 4x: this PR @ 095a6434
GPU ms a frame (median) 7.47 7.66 7.76 7.89
short blades, white px in the upper half (2 shots) 1336 / 1243 3645 / 3647 4462 / 4416
Hyrule Field: GPU ms a frame (10 s blocks) 9.29 / 9.49 9.72 / 9.12 9.84 / 9.86 / 9.46

Hyrule Field's grass (by the Kakariko gate, debug build, white view, one run from one spot, the tiles made again after each change by nudging the foliage object's +0x7c): white px per 40 px screen band from the middle distance to near, the game's values 6501 / 5756 / 3718 / 2925, the falloff 3x 7010 / 7426 / 5498 / 4000 (+8 to +48 %), the game's own +0x7c = 24 (also 3x) 6246 / 7517 / 6682 / 4502 for comparison.

grass_distance 0 blocks ['7.58', '7.47', '7.46'] median 7.470
grass_distance 1 blocks ['7.66', '7.66'] median 7.660
grass_distance 2 blocks ['7.76', '7.76'] median 7.760
grass_distance 3 blocks ['7.89', '7.78'] median 7.890

Screenshots are in the comments: Kokiri Forest's normal picture at Game's, 2x and 4x and the debug view with the short blades white; Hyrule Field's debug view with the grass white.

Flags and settings

A new menu row and ini key, and a switch for it.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
Grass distance (grass_distance) Graphics row: the short grass blades' reach none (the game's reach) 2x the short blades' patch radius and fades, and the main grass's full-density distance, 2x, 3x or 4x as far helps in Kokiri Forest and Hyrule Field 2x for everyone; 4x on fast cards
RX_VK_GRASS_DISTANCE switch over the row for one run none unset 1 to 8 times the game's reach for testing unset

Testing

Tested: Windows 11, RTX 5090: the row in the menu, saved as grass_distance, changed live through the control bridge at Kokiri's stepping stones (pictures and timings above); Hyrule Field by the Kakariko gate, the log showing each program's words changed once, GPU time at Game's, 2x and 4x; python -I -B tests/run_all.py: 592 passed, 40 failed, 90 skipped; main @ 544229a2 on the same PC: 591 passed, the same 40 failed, 90 skipped. The 40 fail on main too on this PC (tools and compilers it lacks): test_auto_handheld.py, test_bug_report_defaults.py, test_cpu_report.py, test_crash_dialog.py, test_crt_options.py, test_damage_debug_menu.py, test_display_startup_failure.py, test_dlss_feature_size.py, test_failed_compile_keeps_objects.py, test_fastfp_fma.py, test_fpx_sticky.py, test_framegen_preset.py, test_guest_imported.py, test_hud_layout_row.py, test_invalidate_vcore.py, test_job_queue.py, test_linux_preflight.py, test_linux_pressure.py, test_mirror_budget.py, test_missing_nup.py, test_pads_after_menu.py, test_pending_guest_import.py, test_perf_report.py, test_pipeline_play_cache.py, test_present_thread.py, test_profiling_mode.py, test_readback_timeout_source.py, test_rumble_menu.py, test_run_all_changed.py, test_slow_frames.py, test_spawn_emit.py, test_switch_table.py, test_target_image_pool.py, test_tested_configurations.py, test_upscaler_round_trip.py, test_upscaler_rows.py, test_vcore_escape.py, test_vk_occlusion_queries.py, test_vk_swapchain_compat.py, test_walk_key.py. The new test passes.

Not tested: AMD and Intel GPUs, Linux, the Steam Deck; other areas with these blades than Kokiri Forest.

Must be tested:

  • windows, amd and linux, radv: Kokiri Forest, stand on the stepping stones facing the exit, switch Grass distance between Game's and 4x, expecting more short blades on the ground before the exit at 4x and nothing else changing (Test Farm: @Beanstalk Kokiri Forest stepping stones, Grass distance Game's against 4x)
  • steamdeck: the same spot at 2x and Game's, expecting the frame rate to hold (Test Farm)

Risks

What could break: a program that shares one of the three keys in another game version would get its values scaled; only positive values of the named words of binding c3 are touched. The patched copy goes through the same stream as other uniform copies.

Turning it off: Grass distance: Game's, or RX_VK_GRASS_DISTANCE=1.

Compatibility: a new key in longshot_options.ini (grass_distance=1 by default); no shader or pipeline cache change, no vk ABI change.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks. Not ticked yet: Measurements covers only the RTX 5090, and the Steam Deck frame-rate cost is expected but not measured.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built and run on Windows with llvm-mingw; Linux: the CI's build, not run here.)

🤖 Generated with Claude Code

**Type:** feat · **Risk:** low · **Tested on:** Windows 11, RTX 5090 (NVIDIA 621.01) · **Needs:** AMD, Intel; Steam Deck ## Why Kokiri Forest's short grass blades and the moss on its stones stop about 20 m from the camera. From the stepping stones the ground in front of the forest's exit looks bare, and the blades only grow in as Link walks up to it. Hyrule Field's grass is full only within 8 m of the camera and thins out quickly beyond, so the field looks barren in the middle distance. Players asked for more grass draw distance in #950 and #205. See #950, #205. ## What changed A new Graphics row, **Grass distance** (Game's, 2x, 3x, 4x; 2x by default), makes the short blades reach that many times as far and keeps Hyrule Field's grass full that many times as far. It changes only the copy of a few uniform values the GPU reads, never the game's memory. The short blades change at once; the field's grass as the game makes its ground tiles (Link moving on, the area loading). Why three values in three programs: the game draws the blades from patches that the compute program 383a566958350efe picks around Link (word 75 of its scene buffer: a 22 m radius). Each blade then goes through a random cut by its distance in the task stage of **both** programs that draw it, 43ec86f35fd937b9 (the colour) and 8a8304edb7bdf4bf (a second pass over the same blades); words 46 and 47 of their scene buffer make a fade from 12 m to about 20 m. Lifting the cut in only one of the two passes changes nothing on screen, which is why this took a while to find. The main grass (Hyrule Field's): compute d5a9475f2790532e gives each ground tile a blade count of the density times 1 - (1 + w97 - w96/d²): full to √w96 (8 m), then falling as 1/d² to none at √(w96/w97) (65 m). The game's own foliage setting for it (the foliage object's +0x7c) moves both words together; the row multiplies both by n², so the full count reaches n times as far and the end stays at 65 m. - vk: `grass_reach()` and `grass_words()` in `gpu/vk/vk_draw.cpp`; `uniform_range()` copies a binding c3 of those three programs into the stream and scales the words (radius times n, both fade ends divided by n). Only positive values are changed: the same slot holds other numbers in other stages. `draw()` and `dispatch()` tell `uniform_range()` the program (`ub_prog_key`). d5a9475f2790532e's words 96 and 97 times n². Each changed word is logged once: `vk: Grass distance 2x: program ... word ... a -> b`. - menu: the row in `gpu/vk/vk_menu.cpp` (`tx_grass_distance`), `opts.grass_distance` in `gpu/vk/vk_menu.h`; no Quality preset sets it (preset-exempt, as Anisotropic filtering). - switch: `RX_VK_GRASS_DISTANCE=<n>` (1 to 8) over the row for one run, in `gpu/vk/switches.def`. - docs: README option table and Graphics notes; `grass_distance` in docs/development.md's options file table. - tests: `tests/test_grass_distance.py` keeps the row, its labels and the reach table in step, and names the three programs. ## Measurements **Verdict:** helps: from Kokiri's stepping stones the blades reach the ground before the exit, and Hyrule Field's grass stays full further out (30 to 48 % more blades in the middle distance at 3x, as the game's own foliage setting gives); the short blades' area in the upper half of the frame goes from about 1300 px (Game's) to 3650 px (2x) and 4400 px (4x), and the GPU frame grows by 0.19 ms at 2x, 0.42 ms at 4x in Kokiri Forest and about 0.35 ms at 4x in Hyrule Field, 2x there within the noise (RTX 5090, 2560x1440). Hardware: Windows 11, RTX 5090, NVIDIA 621.01, 32 threads Scene: Kokiri Forest, the save's start walked to the stepping stones (1.1, 3.25), the camera tilted up a little to show the ground before the exit; output 2560x1440, DLSS, no frame generation, 60 fps cap Method: GPU time: `RX_VK_PASS_TIMING=1` (the "ms a frame in all" line, every 600 presents), one run, the row changed live through the control bridge in the order Game's, 4x, 2x, 3x, Game's, 4x, 2x, 3x, 25 s each; the median of the blocks that lie wholly inside each value's time. Blade area: a debug build that skips 43ec86f35fd937b9's draws (the blades then show white where the second pass drew them), two shots per value, white pixels in the upper half. Baseline: this PR at Game's, which leaves the three values as main has them, in the same run, so the row can be switched live and the values interleaved (main has no row to switch). The blade counts come from the debug build with the same values set through a uniform patch switch. The Kokiri Forest numbers were taken on ed84459d, the first commit; 095a6434 adds the main grass and leaves the short blades' code as it was. How to reproduce: Kokiri Forest, stand on the stepping stones looking at the exit, switch Grass distance between Game's and 4x. | | Before, Game's: this PR @ 095a6434 | After, 2x: this PR @ 095a6434 | After, 3x: this PR @ 095a6434 | After, 4x: this PR @ 095a6434 | |---|---|---|---|---| | GPU ms a frame (median) | 7.47 | 7.66 | 7.76 | 7.89 | | short blades, white px in the upper half (2 shots) | 1336 / 1243 | 3645 / 3647 | | 4462 / 4416 | | Hyrule Field: GPU ms a frame (10 s blocks) | 9.29 / 9.49 | 9.72 / 9.12 | | 9.84 / 9.86 / 9.46 | Hyrule Field's grass (by the Kakariko gate, debug build, white view, one run from one spot, the tiles made again after each change by nudging the foliage object's +0x7c): white px per 40 px screen band from the middle distance to near, the game's values 6501 / 5756 / 3718 / 2925, the falloff 3x 7010 / 7426 / 5498 / 4000 (+8 to +48 %), the game's own +0x7c = 24 (also 3x) 6246 / 7517 / 6682 / 4502 for comparison. ``` grass_distance 0 blocks ['7.58', '7.47', '7.46'] median 7.470 grass_distance 1 blocks ['7.66', '7.66'] median 7.660 grass_distance 2 blocks ['7.76', '7.76'] median 7.760 grass_distance 3 blocks ['7.89', '7.78'] median 7.890 ``` Screenshots are in the comments: Kokiri Forest's normal picture at Game's, 2x and 4x and the debug view with the short blades white; Hyrule Field's debug view with the grass white. ### Flags and settings A new menu row and ini key, and a switch for it. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | Grass distance (`grass_distance`) | Graphics row: the short grass blades' reach | none (the game's reach) | 2x | the short blades' patch radius and fades, and the main grass's full-density distance, 2x, 3x or 4x as far | helps in Kokiri Forest and Hyrule Field | 2x for everyone; 4x on fast cards | | `RX_VK_GRASS_DISTANCE` | switch over the row for one run | none | unset | 1 to 8 times the game's reach | for testing | unset | ## Testing **Tested:** Windows 11, RTX 5090: the row in the menu, saved as `grass_distance`, changed live through the control bridge at Kokiri's stepping stones (pictures and timings above); Hyrule Field by the Kakariko gate, the log showing each program's words changed once, GPU time at Game's, 2x and 4x; `python -I -B tests/run_all.py`: 592 passed, 40 failed, 90 skipped; main @ 544229a2 on the same PC: 591 passed, the same 40 failed, 90 skipped. The 40 fail on main too on this PC (tools and compilers it lacks): `test_auto_handheld.py`, `test_bug_report_defaults.py`, `test_cpu_report.py`, `test_crash_dialog.py`, `test_crt_options.py`, `test_damage_debug_menu.py`, `test_display_startup_failure.py`, `test_dlss_feature_size.py`, `test_failed_compile_keeps_objects.py`, `test_fastfp_fma.py`, `test_fpx_sticky.py`, `test_framegen_preset.py`, `test_guest_imported.py`, `test_hud_layout_row.py`, `test_invalidate_vcore.py`, `test_job_queue.py`, `test_linux_preflight.py`, `test_linux_pressure.py`, `test_mirror_budget.py`, `test_missing_nup.py`, `test_pads_after_menu.py`, `test_pending_guest_import.py`, `test_perf_report.py`, `test_pipeline_play_cache.py`, `test_present_thread.py`, `test_profiling_mode.py`, `test_readback_timeout_source.py`, `test_rumble_menu.py`, `test_run_all_changed.py`, `test_slow_frames.py`, `test_spawn_emit.py`, `test_switch_table.py`, `test_target_image_pool.py`, `test_tested_configurations.py`, `test_upscaler_round_trip.py`, `test_upscaler_rows.py`, `test_vcore_escape.py`, `test_vk_occlusion_queries.py`, `test_vk_swapchain_compat.py`, `test_walk_key.py`. The new test passes. **Not tested:** AMD and Intel GPUs, Linux, the Steam Deck; other areas with these blades than Kokiri Forest. **Must be tested:** - windows, amd and linux, radv: Kokiri Forest, stand on the stepping stones facing the exit, switch Grass distance between Game's and 4x, expecting more short blades on the ground before the exit at 4x and nothing else changing (Test Farm: @Beanstalk Kokiri Forest stepping stones, Grass distance Game's against 4x) - steamdeck: the same spot at 2x and Game's, expecting the frame rate to hold (Test Farm) ## Risks **What could break:** a program that shares one of the three keys in another game version would get its values scaled; only positive values of the named words of binding c3 are touched. The patched copy goes through the same stream as other uniform copies. **Turning it off:** Grass distance: Game's, or `RX_VK_GRASS_DISTANCE=1`. **Compatibility:** a new key in longshot_options.ini (`grass_distance=1` by default); no shader or pipeline cache change, no vk ABI change. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [ ] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. Not ticked yet: Measurements covers only the RTX 5090, and the Steam Deck frame-rate cost is expected but not measured. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. - [ ] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built and run on Windows with llvm-mingw; Linux: the CI's build, not run here.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(vk): Grass distance, how far the short grass blades reach (2x by default)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
ed84459dbf
Kokiri Forest's short tufts and the moss on its stones stop about 20 m from the camera, so from the stepping stones the ground before the forest's exit is bare until Link walks up to it. They come from patches a compute program picks within 22 m of Link (383a566958350efe, its scene buffer's word 75), and each blade goes through a random cut by its distance in the task stage of both programs that draw it, 43ec86f35fd937b9 and 8a8304edb7bdf4bf (words 46 and 47: a fade from 12 m to about 20 m). Lifting the cut in only one of the two passes changes nothing on screen.

The new Graphics row, Grass distance (Game's, 2x, 3x, 4x; 2x by default), makes the radius and both fades that many times as far, in the copy of the scene buffer the GPU reads (uniform_range, grass_reach, grass_words); only positive values are changed, as the slot holds other numbers in other stages. RX_VK_GRASS_DISTANCE=<n> sets it for one run. tests/test_grass_distance.py keeps the row, its labels and the reach table together.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
First-time contributor

Tested in game: Windows 11, RTX 5090 (NVIDIA 621.01): Kokiri Forest, the save's start walked to the stepping stones facing the exit. Grass distance switched live between Game's, 2x, 3x and 4x: at 2x and 4x the short blades grow on the ground before the exit, nothing else changes; GPU frame +0.19 ms at 2x, +0.42 ms at 4x (2560x1440, RX_VK_PASS_TIMING=1).

Tested in game: Windows 11, RTX 5090 (NVIDIA 621.01): Kokiri Forest, the save's start walked to the stepping stones facing the exit. Grass distance switched live between Game's, 2x, 3x and 4x: at 2x and 4x the short blades grow on the ground before the exit, nothing else changes; GPU frame +0.19 ms at 2x, +0.42 ms at 4x (2560x1440, RX_VK_PASS_TIMING=1).
Author
First-time contributor

Screenshots, Kokiri Forest from the stepping stones facing the exit, 2560x1440 output (shots at 1280x720, cropped to the far ground).

The normal picture, this PR @ ed84459d, Grass distance Game's, 2x and 4x: more short blades on the ground before the exit and around the purple flowers.

Kokiri exit, normal picture: Game's, 2x, 4x

The same spot in a debug build that skips 43ec86f35fd937b9's draws, so the short blades show white where the second pass (8a8304edb7bdf4bf) draws them; the values set as the row sets them at Game's, 2x and 4x. At Game's they stop at the first stones; at 2x and 4x they cover the ground before the exit and the slopes beside it.

Kokiri exit, short blades white: Game's, 2x, 4x

Screenshots, Kokiri Forest from the stepping stones facing the exit, 2560x1440 output (shots at 1280x720, cropped to the far ground). The normal picture, this PR @ ed84459d, Grass distance Game's, 2x and 4x: more short blades on the ground before the exit and around the purple flowers. ![Kokiri exit, normal picture: Game's, 2x, 4x](https://git.magicbean.dev/attachments/100f2c7b-087c-49e1-8ad7-896c2f64315d) The same spot in a debug build that skips 43ec86f35fd937b9's draws, so the short blades show white where the second pass (8a8304edb7bdf4bf) draws them; the values set as the row sets them at Game's, 2x and 4x. At Game's they stop at the first stones; at 2x and 4x they cover the ground before the exit and the slopes beside it. ![Kokiri exit, short blades white: Game's, 2x, 4x](https://git.magicbean.dev/attachments/df7fcfb8-89b7-4c2f-91ea-f2c85acb2109)
feat(vk): Grass distance also keeps Hyrule Field's grass full further out
Some checks are pending
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 9s
095a64343b
The main grass (Hyrule Field's) gets its blade count per ground tile from compute d5a9475f2790532e: the density times 1 - (1 + w97 - w96 / d^2), so full to sqrt(w96) (8 m), then falling as 1 / d^2 to none at sqrt(w96 / w97) (65 m). The game's own foliage setting for it (the foliage object's +0x7c) moves both words together; the row now multiplies both by n^2, so the full count reaches n times as far and the end stays at 65 m. The compute runs when the game makes a tile, so a change of the row reaches the main grass as Link moves on or the area loads again.

grass_words gives each word the power of the reach it is multiplied by; each changed word is logged once ("vk: Grass distance ..."). Measured in Hyrule Field by the Kakariko gate: the blades in the middle distance 30 to 48 % more at 3x, as the game's own +0x7c = 24 gives; GPU +0.35 ms a frame at 4x on an RTX 5090 at 1440p, 2x within the noise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
winterelfeas changed title from WIP: feat(vk): Grass distance, how far the short grass blades reach (2x by default) to WIP: feat(vk): Grass distance, how far the grass stays full (2x by default) 2026-11-17 10:08:11 +00:00
Author
First-time contributor

New commit 095a6434: Grass distance now also keeps Hyrule Field's grass full further out. Compute d5a9475f2790532e thins the main grass per ground tile as 1 - (1 + w97 - w96/d²): full to 8 m, none at 65 m. The row multiplies w96 and w97 by n², as the game's own foliage setting for it (+0x7c) does, so the full count reaches n times as far. It reaches tiles as the game makes them (Link moving on, the area loading). Each changed word is now logged once.

Hyrule Field by the Kakariko gate, the debug view with the grass white, one run from one spot, the tiles made again after each change. White px per screen band from the middle distance to near: game's values 6501 / 5756 / 3718 / 2925; the falloff 3x 7010 / 7426 / 5498 / 4000; the game's own +0x7c = 24, for comparison, 6246 / 7517 / 6682 / 4502. GPU time there (RTX 5090, 1440p, 10 s blocks): Game's 9.29 / 9.49 ms, 2x 9.72 / 9.12 ms, 4x 9.84 / 9.86 / 9.46 ms. The description has the details.

Hyrule Field, grass white: game's values, falloff 3x, the game's own +0x7c = 24

New commit 095a6434: Grass distance now also keeps Hyrule Field's grass full further out. Compute d5a9475f2790532e thins the main grass per ground tile as 1 - (1 + w97 - w96/d²): full to 8 m, none at 65 m. The row multiplies w96 and w97 by n², as the game's own foliage setting for it (+0x7c) does, so the full count reaches n times as far. It reaches tiles as the game makes them (Link moving on, the area loading). Each changed word is now logged once. Hyrule Field by the Kakariko gate, the debug view with the grass white, one run from one spot, the tiles made again after each change. White px per screen band from the middle distance to near: game's values 6501 / 5756 / 3718 / 2925; the falloff 3x 7010 / 7426 / 5498 / 4000; the game's own +0x7c = 24, for comparison, 6246 / 7517 / 6682 / 4502. GPU time there (RTX 5090, 1440p, 10 s blocks): Game's 9.29 / 9.49 ms, 2x 9.72 / 9.12 ms, 4x 9.84 / 9.86 / 9.46 ms. The description has the details. ![Hyrule Field, grass white: game's values, falloff 3x, the game's own +0x7c = 24](https://git.magicbean.dev/attachments/f78ec126-2421-4d3f-92f1-3be3cb4ee3b9)
Author
First-time contributor

@Beanstalk please test 095a6434 (the branch's head; nothing more will be pushed before your run) on windows amd, linux radv and steamdeck.

  1. Kokiri Forest: from the save's start walk to the stepping stones and face the forest's exit. Switch Graphics > Grass distance between Game's and 4x (it applies at once). Expected: at 4x more short grass blades on the ground in front of the exit and on the slopes beside it; nothing else changes (no flicker, no missing ground, no other plants affected).
  2. Hyrule Field, by the Kakariko gate: set Grass distance to Game's, leave Kokiri and walk into the field; then set 4x and load the field again (go through the gate and back). Expected: at 4x the field's grass stays full further from the camera; no holes or blocks of missing grass near Link.
  3. Steam Deck only: the Kokiri spot at Game's and at 2x (the default), expecting the frame rate to hold.

In longshot_log.txt each changed value is logged once, e.g. "vk: Grass distance 4x: program 383a566958350efe word 75 22 -> 88": please include those lines and the GPU / driver with the results.

@Beanstalk please test 095a6434 (the branch's head; nothing more will be pushed before your run) on windows amd, linux radv and steamdeck. 1. Kokiri Forest: from the save's start walk to the stepping stones and face the forest's exit. Switch Graphics > Grass distance between Game's and 4x (it applies at once). Expected: at 4x more short grass blades on the ground in front of the exit and on the slopes beside it; nothing else changes (no flicker, no missing ground, no other plants affected). 2. Hyrule Field, by the Kakariko gate: set Grass distance to Game's, leave Kokiri and walk into the field; then set 4x and load the field again (go through the gate and back). Expected: at 4x the field's grass stays full further from the camera; no holes or blocks of missing grass near Link. 3. Steam Deck only: the Kokiri spot at Game's and at 2x (the default), expecting the frame rate to hold. In longshot_log.txt each changed value is logged once, e.g. "vk: Grass distance 4x: program 383a566958350efe word 75 22 -> 88": please include those lines and the GPU / driver with the results.
Member

@winterelfeas only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@winterelfeas only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner

Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).

  • Tested on my own PC: ticked: Testing's Tested and author comment: an in-game run on Windows 11, RTX 5090 (NVIDIA 621.01) by the author.
  • Nothing gets worse that I know of: not ticked: Measurements covers only the RTX 5090, and the Steam Deck frame-rate cost is expected but not measured. Measure that cost and state it in Risks, then tick it.
Brought up to the [ready-for-review standard](https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/CONTRIBUTING.md#ready-for-review-out-of-wip) (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know). - *Tested on my own PC*: ticked: Testing's Tested and author comment: an in-game run on Windows 11, RTX 5090 (NVIDIA 621.01) by the author. - *Nothing gets worse that I know of*: not ticked: Measurements covers only the RTX 5090, and the Steam Deck frame-rate cost is expected but not measured. Measure that cost and state it in Risks, then tick it.
Some checks are pending
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval waiting for a BigBean's 👍 on the request
PR description / Description follows the template (pull_request_target) Successful in 9s
This pull request has changes conflicting with the target branch.
  • README.md
  • gpu/vk/vk_draw.cpp
Some workflows are waiting to be reviewed.
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'grass-distance:winterelfeas-grass-distance'
git switch 'winterelfeas-grass-distance'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1382
No description provided.