[PR #3764] [CLOSED] Frame Generation setting: FSR 3.1 (frame generation 3/3) #5200

Closed
opened 2026-11-03 05:10:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3764
Author: @spidercraft
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fsr-frame-generation


📝 Commits (4)

  • a917633 FSR 3.1 optical flow, ported to WGSL (frame generation 1/3)
  • 572c5c4 FSR 3.1 frame interpolation, ported to WGSL (frame generation 2/3)
  • 99de7ad Frame Generation setting: FSR 3.1, its present thread and the hand (frame generation 3/3)
  • b07a7ba Frame generation: mobs' and dropped items' own motion vectors, F3 frame rate

📊 Changes

18 files changed (+4154 additions, -143 deletions)

View changed files

📝 THIRD_PARTY_NOTICES.md (+9 -0)
📝 crates/horizon-client-render/src/gfx.rs (+287 -138)
➕ crates/horizon-client-render/src/gfx/frame_gen.rs (+543 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/interpolation.rs (+872 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/interpolation.wgsl (+810 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/motion.rs (+306 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/motion.wgsl (+58 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/optical_flow.rs (+631 -0)
➕ crates/horizon-client-render/src/gfx/frame_gen/optical_flow.wgsl (+537 -0)
📝 crates/horizon-client-render/src/gfx/world_post.rs (+16 -1)
📝 crates/horizon-client-render/src/graphics.rs (+36 -1)
📝 crates/horizon-client-render/src/graphics_ui.rs (+14 -1)
📝 crates/horizon-client/src/game.rs (+15 -0)
📝 crates/horizon-client/src/game/creatures.rs (+1 -0)
📝 crates/horizon-client/src/game/debug_keys.rs (+12 -1)
📝 crates/horizon-client/src/game/item_draw.rs (+1 -0)
📝 crates/horizon-client/src/game/options.rs (+3 -0)
📝 docs/graphics.md (+3 -1)

📄 Description

🤖 Opened by Claude Code.

Frame generation, part 3 of 3. This PR: the setting that runs it. It is built on #3762 (the optical flow, part 1) and #3763 (the frame interpolation, part 2): merge them first; this branch contains both, so review this PR's own two commits. Toward #2922.

What players get

In Options → Video Settings (Horizon's graphics settings), Display: Frame Generation: Off / FSR 3.1 (frameGeneration in horizon-graphics.txt, off or fsr3.1). It's off by default, so the vanilla look doesn't change. With it on, a frame made by FSR 3.1's frame interpolation is shown between each two real ones: twice the frames on screen, about half a real frame more latency. It works on every GPU Horizon runs on: the ported shaders need nothing past WebGPU's defaults.

How it works (gfx/frame_gen.rs, gfx.rs)

  • While it's on, the world's post pass draws into a texture of its own at the screen's size (the world without the hand and HUD), copied onto the real frame. The optical flow (part 1) and the interpolation (part 2) run on it; its camera is the frame's depth, TAA's jitter, and this frame's clip space to the last (world_post::reprojection).
  • The hand, entity outlines, screen effects, the debug crosshair and the HUD are drawn over the made frame as over the real one (draw_overlay, moved out of draw_frame unchanged), instead of AMD's HUD-less blending. The hand is drawn at its halfway pose: each vertex halfway between where it was on screen last frame and where it is now, back in this frame's space, so its swing and bob are smooth too. When the held item changes, that frame shows the current hand as it is.
  • Presenting: the renderer draws into frames of its own, and a present thread copies each pair to the swapchain: the made frame, then the real one half a real frame later (the smoothed time between real frames). A bounded channel makes the renderer wait like a swapchain would. The surface is shared with the thread (Arc); it's stopped before every reconfigure, resize, present mode change or surface hand-over, so only one side ever acquires. The swapchain gets COPY_DST where the surface offers it.
  • With VSync (Fifo), real frames run at half the refresh rate and every refresh gets a frame.
  • Off under a shader pack's post passes, with HDR output, on the title screen and over menus that blur the frame, and where the surface can't be copied into.
  • Mobs and dropped items move on their own (frame_gen/motion.{rs,wgsl}): the camera's motion vectors see them as still, so the made frame would show them where the real one does. The game tags each mob's and dropped item's vertices with its entity id (Frame::entity_motion, marked in mob_geometry and dropped_item_geometry). When an entity's model has the same shape as last frame (vertex count, UVs, layers), each vertex gets its own motion: walking, limbs, bobbing and spin. A pass draws those vectors into a texture at the render size, only where the world shows the entity: where the depth is its own, or, for translucent items (which don't write depth, as in vanilla), where its texture is opaque and nothing is in front. The interpolation's prepare pass uses them over the camera's. That's the game motion vectors FSR expects, which Horizon didn't have.
  • F3: while it runs, the first line adds the frames reaching the screen: 120 fps (239 fps FSR 3.1) T: …, the game's FPS times the share of real frames that got a made frame. Unchanged otherwise.
  • HORIZON_FRAMEGEN_DEBUG=generated shows (and screenshots) only made frames, like AMD's debug view; motion paints, on each made frame, what has motion vectors of its own in blue.
  • docs/graphics.md has a paragraph on it.

Known limits:

  • Other things that move on their own (boats, minecarts, projectiles, falling blocks) aren't tagged yet: they follow the optical flow, which is coarser (8×8 blocks). Each is one mark_motion call in its builder.
  • Not with HDR yet.

Checked

  • the_made_frame_s_hand_is_halfway_on_screen: a swing lands halfway; a hand that's still on screen while the camera turns stays put; another item shows as it is.
  • tracks_each_entity_by_id: an entity seen last frame gets its vertices' own motion in this frame's camera space; a new one, one whose model changed and untagged geometry get none.
  • moves_what_has_its_own_motion_vectors_halfway: a still camera, a picture moving with its own motion vectors: the made frame's error against the true halfway frame is under a quarter of either real frame's.
  • Parts 1 and 2's GPU tests pass; the settings round-trip and the options screen tests cover the new key and row.
  • cargo test -p horizon-client-render --lib: 530 passed. cargo test -p horizon-client --lib --bins: all passed. cargo clippy -p horizon-client-render -p horizon-client --all-targets -D warnings and rustfmt clean.
  • In game, offscreen with horizon-ctl and HORIZON_FRAMEGEN_DEBUG=generated: made frames with the camera still and mid-turn, and mid-swing with a sword, look right (no holes or tearing, the hand whole). No GPU validation errors. 110 FPS offscreen at 1865×2100 with GPU time 1.3 ms a frame.
  • With HORIZON_FRAMEGEN_DEBUG=motion: summoned pigs and zombies come out as solid blue silhouettes, and a dropped diamond stack as its sprites' shapes (before the translucent-item path, items showed none). F3 reads 120 fps (239 fps FSR 3.1) at a 120 cap.
  • Tested by hand in the game on an RTX 5090 (Vulkan, Linux, Mailbox): smooth, the hand smooth too, and mobs and dropped items smooth.
  • tools/pr_ready.py wasn't run; CI's checks cover it.

Size: about 1370 added and 160 removed, over the ~500 guideline. About 230 of those lines move the overlay draws into draw_overlay unchanged, so the made frame can draw them too, and about 250 are tests. The entity motion is its own commit, and it adds an object_motion input to part 2's interpolation, which can't build without this PR's motion module. Happy to split it into a fourth PR if you'd rather.

Label: feature, for the maintainer to add.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3764 **Author:** [@spidercraft](https://github.com/spidercraft) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fsr-frame-generation` --- ### 📝 Commits (4) - [`a917633`](https://github.com/horizon-rust/horizon/commit/a91763379f4c26106576028061306fd057f52500) FSR 3.1 optical flow, ported to WGSL (frame generation 1/3) - [`572c5c4`](https://github.com/horizon-rust/horizon/commit/572c5c46640fb98f8495a3f3551b4bc97a39efe4) FSR 3.1 frame interpolation, ported to WGSL (frame generation 2/3) - [`99de7ad`](https://github.com/horizon-rust/horizon/commit/99de7ad4110e225a32290bd7e775cff93ce23cb9) Frame Generation setting: FSR 3.1, its present thread and the hand (frame generation 3/3) - [`b07a7ba`](https://github.com/horizon-rust/horizon/commit/b07a7bad899c74e892b380ec49a201a33d101461) Frame generation: mobs' and dropped items' own motion vectors, F3 frame rate ### 📊 Changes **18 files changed** (+4154 additions, -143 deletions) <details> <summary>View changed files</summary> 📝 `THIRD_PARTY_NOTICES.md` (+9 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+287 -138) ➕ `crates/horizon-client-render/src/gfx/frame_gen.rs` (+543 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/interpolation.rs` (+872 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/interpolation.wgsl` (+810 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/motion.rs` (+306 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/motion.wgsl` (+58 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/optical_flow.rs` (+631 -0) ➕ `crates/horizon-client-render/src/gfx/frame_gen/optical_flow.wgsl` (+537 -0) 📝 `crates/horizon-client-render/src/gfx/world_post.rs` (+16 -1) 📝 `crates/horizon-client-render/src/graphics.rs` (+36 -1) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+14 -1) 📝 `crates/horizon-client/src/game.rs` (+15 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -0) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+12 -1) 📝 `crates/horizon-client/src/game/item_draw.rs` (+1 -0) 📝 `crates/horizon-client/src/game/options.rs` (+3 -0) 📝 `docs/graphics.md` (+3 -1) </details> ### 📄 Description > 🤖 Opened by Claude Code. **Frame generation, part 3 of 3.** This PR: the setting that runs it. It is built on #3762 (the optical flow, part 1) and #3763 (the frame interpolation, part 2): merge them first; this branch contains both, so review this PR's own two commits. Toward #2922. ## What players get In Options → Video Settings (Horizon's graphics settings), Display: **Frame Generation: Off / FSR 3.1** (`frameGeneration` in `horizon-graphics.txt`, `off` or `fsr3.1`). It's off by default, so the vanilla look doesn't change. With it on, a frame made by FSR 3.1's frame interpolation is shown between each two real ones: twice the frames on screen, about half a real frame more latency. It works on every GPU Horizon runs on: the ported shaders need nothing past WebGPU's defaults. ## How it works (`gfx/frame_gen.rs`, `gfx.rs`) - While it's on, the world's post pass draws into a texture of its own at the screen's size (the world without the hand and HUD), copied onto the real frame. The optical flow (part 1) and the interpolation (part 2) run on it; its camera is the frame's depth, TAA's jitter, and this frame's clip space to the last (`world_post::reprojection`). - The hand, entity outlines, screen effects, the debug crosshair and the HUD are drawn over the made frame as over the real one (`draw_overlay`, moved out of `draw_frame` unchanged), instead of AMD's HUD-less blending. The hand is drawn at its **halfway pose**: each vertex halfway between where it was on screen last frame and where it is now, back in this frame's space, so its swing and bob are smooth too. When the held item changes, that frame shows the current hand as it is. - **Presenting:** the renderer draws into frames of its own, and a present thread copies each pair to the swapchain: the made frame, then the real one half a real frame later (the smoothed time between real frames). A bounded channel makes the renderer wait like a swapchain would. The surface is shared with the thread (`Arc`); it's stopped before every reconfigure, resize, present mode change or surface hand-over, so only one side ever acquires. The swapchain gets `COPY_DST` where the surface offers it. - With VSync (Fifo), real frames run at half the refresh rate and every refresh gets a frame. - Off under a shader pack's post passes, with HDR output, on the title screen and over menus that blur the frame, and where the surface can't be copied into. - **Mobs and dropped items move on their own** (`frame_gen/motion.{rs,wgsl}`): the camera's motion vectors see them as still, so the made frame would show them where the real one does. The game tags each mob's and dropped item's vertices with its entity id (`Frame::entity_motion`, marked in `mob_geometry` and `dropped_item_geometry`). When an entity's model has the same shape as last frame (vertex count, UVs, layers), each vertex gets its own motion: walking, limbs, bobbing and spin. A pass draws those vectors into a texture at the render size, only where the world shows the entity: where the depth is its own, or, for translucent items (which don't write depth, as in vanilla), where its texture is opaque and nothing is in front. The interpolation's prepare pass uses them over the camera's. That's the game motion vectors FSR expects, which Horizon didn't have. - **F3:** while it runs, the first line adds the frames reaching the screen: `120 fps (239 fps FSR 3.1) T: …`, the game's FPS times the share of real frames that got a made frame. Unchanged otherwise. - `HORIZON_FRAMEGEN_DEBUG=generated` shows (and screenshots) only made frames, like AMD's debug view; `motion` paints, on each made frame, what has motion vectors of its own in blue. - `docs/graphics.md` has a paragraph on it. **Known limits:** - Other things that move on their own (boats, minecarts, projectiles, falling blocks) aren't tagged yet: they follow the optical flow, which is coarser (8×8 blocks). Each is one `mark_motion` call in its builder. - Not with HDR yet. ## Checked - `the_made_frame_s_hand_is_halfway_on_screen`: a swing lands halfway; a hand that's still on screen while the camera turns stays put; another item shows as it is. - `tracks_each_entity_by_id`: an entity seen last frame gets its vertices' own motion in this frame's camera space; a new one, one whose model changed and untagged geometry get none. - `moves_what_has_its_own_motion_vectors_halfway`: a still camera, a picture moving with its own motion vectors: the made frame's error against the true halfway frame is under a quarter of either real frame's. - Parts 1 and 2's GPU tests pass; the settings round-trip and the options screen tests cover the new key and row. - `cargo test -p horizon-client-render --lib`: 530 passed. `cargo test -p horizon-client --lib --bins`: all passed. `cargo clippy -p horizon-client-render -p horizon-client --all-targets -D warnings` and rustfmt clean. - **In game, offscreen** with horizon-ctl and `HORIZON_FRAMEGEN_DEBUG=generated`: made frames with the camera still and mid-turn, and mid-swing with a sword, look right (no holes or tearing, the hand whole). No GPU validation errors. 110 FPS offscreen at 1865×2100 with GPU time 1.3 ms a frame. - With `HORIZON_FRAMEGEN_DEBUG=motion`: summoned pigs and zombies come out as solid blue silhouettes, and a dropped diamond stack as its sprites' shapes (before the translucent-item path, items showed none). F3 reads `120 fps (239 fps FSR 3.1)` at a 120 cap. - **Tested by hand in the game** on an RTX 5090 (Vulkan, Linux, Mailbox): smooth, the hand smooth too, and mobs and dropped items smooth. - `tools/pr_ready.py` wasn't run; CI's checks cover it. **Size:** about 1370 added and 160 removed, over the ~500 guideline. About 230 of those lines move the overlay draws into `draw_overlay` unchanged, so the made frame can draw them too, and about 250 are tests. The entity motion is its own commit, and it adds an `object_motion` input to part 2's interpolation, which can't build without this PR's motion module. Happy to split it into a fourth PR if you'd rather. Label: `feature`, for the maintainer to add. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
horizon-rust/horizon#5200
No description provided.