GPU: a constant can stand in for indirect light while rays do not run (VICTORY_AMBIENT, off by default) #917
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!917
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-917"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@UwUCammie on GitHub · 2026-11-25 12:43 UTC · original
UwUCammie:feat/ambient-stand-in→main· +325 −0 · 5 files · 2 commits · openThe problem
The title's indirect diffuse light comes from probes it fills by tracing rays. Rays do not run yet, so the program that resolves the probes (
CS_ScreenProbes_TemporalResolve_*) leaves next to nothing, and everything the sun does not reach directly is black (the README's "everything in shadow is black", #512). In the first room that is the whole room: you see the window and the back of the character, and not the walls, the bunk or the posters.The change
With
VICTORY_AMBIENT=<level>the image that program wrote is replaced by one constant, right after its dispatch. The title's own lighting then applies it with the surfaces' colors. It is replaced and not raised, because without rays the resolve's inputs are never written and what it leaves is whatever their memory held.Off by default, and with
offor0: nothing changes without the switch.0.6is the level that looked balanced.The pass is not mine: it is Belobug's, from VIctory-Belobug-AMD (
crates/victory-gpu/src/ambient.rs, on by default there). I fitted it to this tree: the hook after the dispatch, the reset of the list's bound heap, root signature and pipeline, the switch off by default, two small tests.The pass needs
d3dcompiler_47.dllat runtime. On Wine 11.22 with the RX 7900 XT, the default compiler selection returnedE_FAIL; selecting the installed native DLL (d3dcompiler_47=n,b) passed all four ambient tests, including pipeline creation. The level is read once at startup, so changing it takes a restart. After the ambient dispatch, the title’s next compute dispatch rebinds its root signature, pipeline and descriptor heaps.What it gives up
It is a shortcut and says so in its module comment: the same light everywhere, from everywhere, whatever the exposure. It is of no use once rays run (#156, #487), and then it should go.
The image is found by its place in the program's table (root parameter 1, dword 176). If a build's program has another layout the pass logs once and does nothing.
Tested
RX 7900 XT, RADV (Mesa 26.3.1), Wine 11.22 with vkd3d-proton from GE-Proton11-14, diagnostics build, main
f85101bmerged into myokex/victory-amd plus #857 and myokex/victory-amd#6.VICTORY_RELAY=0 VICTORY_LATE_WAIT=3 VICTORY_AMBIENT=0.6.indirect light is replaced by a constant (VICTORY_AMBIENT) level=0.6 width=2560 height=1440, the room is lit from the first gameplay frame to the end of the run (walls, bunk, posters, the drawings on the wall). No device loss, no refused pipeline wait. I did not compare the opening cutscene frame by frame.a253706: it builds, andcargo test -p victory-gpu ambienthas 3 passed (under Wine).cargo clippy -p victory-gpu --all-features: nothing new (the two warnings it prints are indraw.rs:2441andshadow.rs:2675, both on main).Not measured: the frame time. The machine was shared during these runs, so I have no number I trust. The cost is one more dispatch a frame over a 2560x1440 image.
Not tested: Windows, NVIDIA, anything past the first room.
@xunbreakablex on GitHub · 2026-11-25 12:44 UTC · original
NVIDIA data point for this change, in case it helps review (AI-assisted, Claude; run on my machine). I had ported the same pass by hand from Belobug's repository onto
f85101b(default off, credit in the header, never pushed) and ran it once: RTX 4070 (100 W power limit, core at most ~2300 MHz), Ryzen 5 5600 held at 3.95 GHz, Windows 11, driver 621.01, Series X profile,VICTORY_AMBIENT=0.6.So on an NVIDIA card with 32-lane waves the name match and the binding (root parameter 1, dword 176) hold on the build I used. I am not opening a pull request for it; this one is the one to merge.
@Ym1r1710 on GitHub · 2026-11-25 13:01 UTC · original
Tried it on Windows/NVIDIA: 5080, native D3D12, driver on Win11, Series X profile. Tree is
a253706+0b0074eplus some PRs, withRELAY=2 ASYNC_SUBMIT=1 QUEUE2=1 INDIRECT_WINDOW=1.VICTORY_AMBIENT=0.6works here too. The log line shows up (level 0.6, 2560x1440), and the cell is lit: bunk, posters and drawings on the wall, the blue window frame. Before, that whole right half was black.Frame time didn't move. Median 154 ms vs 154-167 ms in the runs right before it without the switch, no device loss.
A side effect I didn't expect: the blocky garbage band along the bottom of the screen that I've had on NVIDIA for a long time is mostly gone with it. So at least part of that band seems to come from the empty probe image.
One heads-up for anyone using a sky/brightness check to detect missing walls: the lit walls trip it now. I had to look at the frames by eye.
@UwUCammie on GitHub · 2026-11-25 13:11 UTC · original
Thanks both, that covers the two things I couldn't check here: that the name match and the binding (root parameter 1, dword 176) hold on NVIDIA, and that the extra pass doesn't show in the frame time. My own timings were taken with another game on the card, so I left them out.
Good point about brightness checks. Anything that counts dark pixels to spot missing walls needs the switch off, or a look by eye. I hadn't connected the band along the bottom with the empty probe image either; I'll look at whether it changes on AMD the next time I have captures of both.
@iGoldenNinja on GitHub · 2026-11-25 13:27 UTC · original · edited 2026-11-25 14:07 UTC
Thanks for identifying the resolve UAV binding. Following up on Ym1r1710’s RTX 5080 ambient result, we sampled the original texture before any ambient substitution.
On the early-depth candidate
74becd8with diagnostic92a72df7b310a4e816ce07a155be1420a6537672, the Series X run reached the prison-window movement tutorial with ordinary copy-back, the BVH builder off and ambient substitution disabled. Hardware was a native RTX 5080 Astral 16 GB / driver 617.14, Ryzen 9 5900X, 32 GB RAM, Windows 11 Pro 25H2 build 26200.9974.The original temporal resolve
34fb51b8a0312e82executed as a direct compute dispatch. Root table 1, dword 176 pointed to a 2560 × 1440R32_UINTtexture. Five numerical readbacks completed during the launch. Two fell in a matched 48-second prison-window view. Eight rows per sample gave 7,794 nonzero RGB values of 20,480 at frame 2,643 and 6,386 of 20,480 at frame 2,707. Combined, 14,180/40,960 observations (34.62%) had nonzero RGB under the PR’s RGB9E5 interpretation, including 8,432 with a very small shared exponent of 0–3.The sampled rows contained a mixture of zero, faint and nonzero values. Whether those values are correct and how they contribute to the displayed lighting remain open. A WARP texture-copy fixture and three other focused tests passed. We stopped the live run deliberately without a logged device removal.
Pinned findings · Diagnostic source
November 25 follow-up — inputs paired with the original output. A separate native Series X prison-window run on the same RTX 5080 and driver used diagnostic revision
fefc2e24f92c8e119f19a0f07b37220e11a7bcbfwith the ray builder and ambient override off. All 23 input slots in each of five sampled dispatches joined one numeric readback of root 1, dword 176 from that exact completed dispatch. Two earlier compute passes bound UAVs of the same host textures subsequently bound for reading in all five samples. Tiled lighting material-mask generation matched resolve root 1, dword 16. Indirect diffuse screen-space bent-cone disocclusion dilation matched root 1, dword 56.Across 115 SRV observations, 10 matched those earlier UAV bindings, 65 tracked textures had no earlier tracked compute UAV that frame, and 40 slots were unresolved by the trace. The output rows contained 31,141/102,400 nonzero RGB observations (30.41%). These bindings identify candidate inputs. Actual shader stores, subresource overlap, input contents and ray contribution remain unverified. Pinned input-binding report
@UwUCammie on GitHub · 2026-11-25 14:08 UTC · original
Thanks, that's more than I measured here. It fits what I saw on AMD, with one correction to my own wording: the image isn't empty, it holds next to nothing.
In RGB9E5 an exponent of 0–3 caps a channel at 511 · 2^(3−24) ≈ 0.00024, so 8,432 of your 14,180 nonzero samples are black on screen. For scale, the 0.6 the switch writes has exponent 15. What decides whether the title's own output is worth keeping is the other 5,748. If you still have the readbacks, an exponent histogram (or just the largest value per sample) would say whether any of that is real light or leftover memory.
65 of 115 inputs with no writer that frame is what I'd expect while the ray passes don't run.
None of this changes the switch as it is (off by default, replaces the whole image). If the larger values turn out to be real, "replace" should become "raise to at least", and I'd change it.
@UwUCammie on GitHub · 2026-11-25 14:29 UTC · original
Thanks for digging those out. So about an eighth of the sampled texels (4,797 of 40,960, and 12,795 of 102,400 in the second run) sit in bins where a channel could reach the 0.6 the switch writes. That is more than "next to nothing", and I'll correct that wording in the description.
What the counts can't say is whether those texels are light. Two things suggest at least some aren't: the pass's own comment (from Belobug's original) names bright magenta on translucent surfaces and blocks of colours indoors as what the resolve leaves, and on Ym1r1710's 5080 the band of blocky colour along the bottom mostly went away when the image was replaced.
To make it checkable by eye I've written
VICTORY_AMBIENT_KEEP=1: the level becomes a floor, and a texel the resolve left brighter keeps its value. The default stays as it is (replace). It compiles and the unit tests pass, but I haven't seen it on my card yet, so I'll push it once I have.The comparison I'd look at is one view with
VICTORY_AMBIENT=0.6and withVICTORY_AMBIENT=0.6 VICTORY_AMBIENT_KEEP=1. If the second only adds plausible brighter patches (bounce near the window, say), the floor should be the default. If it brings the band or the magenta back, replacing is right until rays run.@alexodee on GitHub · 2026-11-25 14:36 UTC · original
A/B on an 8 GB Ampere card, if it helps: RTX 3070 Ti Laptop 8 GB (32-lane waves, driver 596.36), i7-12700H, 15.7 GB RAM, Windows 11, diagnostics build, Series X profile,
VICTORY_RELAY=0, structure builder off. Tree:0b0074e+ #854 #929 #860 #610 #640 and this PR (ambientcommit, merged without a conflict). Same save (first playable room, camera facing the window), one launch per row, three captures each, mean luminance of the whole frame (0-255):VICTORY_AMBIENT=0.3VICTORY_AMBIENT=0.60.6+ skipping the lamps' shadow ray trace (VICTORY_SKIP_PIPELINESon that one program) gives 113: the posters on the wall and the window frame show up too. I take it as a side effect of the missing structure, not as a reason to change this PR.Launch and measurements with AI assistance (Claude Code). No game data.
@npanu420 on GitHub · 2026-11-25 14:57 UTC · original
Works on an RTX 3070 8 GB + i9-9900X, Windows 11, Series S profile. This PR merged cleanly onto a stack of fork main
0b0074e+ ExoCalibra'sd034ac1+ #809, #95, #108, #827, #154.With
VICTORY_AMBIENT=0.6and BVH off, the first cell is readable when the camera turns in. The block walls are clearly light, and the door, its window, the bunk frames, the ceiling and the floor edges all show. Without it, the lamps glow and everything else stays near black.Cost, steady play (median over world frames ≥ 400, same walk into the cell): 219.7 ms with it, against 215.7 ms without. No crash, no device removal.
For comparison on the same build:
VICTORY_HEAP_SYNC_TABLES=1: still dark, and 325 ms.VICTORY_WAVE_PAIRS=0: darker, with stair blocks on silhouettes.(AI-assisted, Claude Code. No game data.)
@iGoldenNinja on GitHub · 2026-11-25 14:17 UTC · original · edited 2026-11-25 15:23 UTC
@UwUCammie We recovered the shared-exponent histogram for the original two RTX 5080 prison samples. Of the 5,748 nonzero texel observations above E3, 4,797 were E15 or higher.
The highest occupied bins were E17 at frame 2643 and E18 at frame 2707. Five later matched dispatches in a separate Series X run had 12,795 at E15+ out of 31,141 nonzero observations. Both runs were native on the RTX 5080 Astral (617.14, Windows 11 Pro 25H2 build 26200.9974), with the ray builder and ambient override off. Exact-zero packed counts matched the zero-RGB counts in every sample, so the nonzero histogram is exact for these seven sampled sets of rows.
E15 and higher are the bins in which a channel could reach 0.6. The histogram did not retain mantissas or coordinates, so the actual peaks, the count reaching 0.6 and whether those texels represent useful scene lighting remain unknown. The report includes each frame's counts, tested revisions and peak bounds. Pinned histogram report · Your histogram question
November 25 follow-up with decoded channels. We ran four additional native Series X prison-window readbacks on the same RTX 5080 / 617.14 / Windows build 26200.9974, using
8f37cddwith the builder and ambient substitution off. Each completed output was paired with all 23 input bindings from the same dispatch.9,916 of 81,920 sampled texel observations (12.10%) had at least one original channel at or above 0.6. The independent R/G/B counts were 9,916 / 4,401 / 5,832 and the channel peaks were 4.40625 / 1.4609375 / 1.2109375. At level 0.6, the tinted and packed replacement decodes to 0.599609375 / 0.587890625 / 0.564453125. Replacing the whole output would overwrite those brighter values. The samples include repeated observations across four frames and keep no pixel coordinates, so they cannot tell us which values are lighting or artifacts. We have not yet run the proposed KEEP comparison on this machine. Pinned report and diagnostic
@oz-stanislav-zhukov on GitHub · 2026-11-25 15:50 UTC · original
One more NVIDIA data point, plus the follow-up in Belobug's tree.
RTX 5060 Ti 16 GB (32-lane, Windows 10 + Agility SDK), i7-14700KF, Series X profile, structure builder off. Tree:
a253706+0b0074e+ the ambient pass ported fromBelobug/VIctory-Belobug-AMD(same name match, root parameter 1 / dword 176).VICTORY_AMBIENT=0.6: the cell and the bar are lit; before, the cell was mostly black. The coloured 8x8 blocks we saw indoors (on hair, walls and posters) are gone too, which fits "what the resolve leaves is whatever the memory held". 3.7-4.1 fps before and after, no visible cost.4ffc4766,cd9f78ce) darken the constant in creases from the resolve's own depth input (table 0, offset 464,R32G8X24_TYPELESS). That binding holds on NVIDIA as well (the pass logsshaded=true). Corners, wall-to-floor joints and the space under the bunks get their depth back, and the room looks less flat. It costs nothing visible in the frame time either. It might be worth a follow-up here once this lands.AI-assisted (Claude Code, Claude Opus 5.5); no game data.
@UwUCammie on GitHub · 2026-11-25 16:43 UTC · original
Thanks for testing on the 5060 Ti. I ported Belobug's crease shading (
4ffc4766+cd9f78ce) locally on my RX 7900 XT under Wine/RADV as well and it works cleanly there too — contact shadows under the bunk and around the window recess look a lot less flat, with no noticeable frame time hit. Happy to put up a follow-up PR for the depth shading once this one merges so this diff stays small.@sawetco on GitHub · 2026-11-25 17:23 UTC · original
I tested
c24462epast the prologue on a desktop RTX 5070. At Jason's waterfront house, a panel beside the character became visible with the game's diffuse resolve enabled and this PR at 0.6. The adjacent shaded wall and the railing were still very dark.I backported this PR onto the Series S performance fork at
97c3aa2with the same face and boat fixes in all runs. That fork also has a shader replacement namedVICTORY_AMBIENT_STUB. I tested the two switches independently. Four separate launches of one executable loaded copies of the same house autosave and warm cache (4,068 shader entries, two pipeline files). Render scale was 0.5, relay 2, late wait 3, andVICTORY_SHADOWMASK_STUB=1throughout. Both runs with the new pass enabled logged a 960×540 target and level 0.6.VICTORY_AMBIENT_STUBVICTORY_AMBIENTValues are median luma in displayed 8-bit RGB, one measurement per capture, across three captures of the same porch camera per run. I sampled every fourth pixel in the rectangles
[80,100,300,340)(panel and surround),[264,132,302,244)(adjacent wall) and[700,65,850,155)(sky) at 960×540. The idle animation and outdoor lighting varied a little across loads. With both switches off a narrow striped opening was visible. With just this PR on, a wider grey panel was visible. The number for that panel should not be read as a room-wide improvement.Windows 11 build 26300.10075, NVIDIA 621.24, Ryzen 5 7600X, 32 GB RAM. Before closing the original play session, we also saw bright windows against a nearly black interior. At night and in dense shade the player described scattered bright points on surfaces. The four controlled comparisons above cover the daytime porch. Performance fork baseline
@tike411 on GitHub · 2026-11-25 18:36 UTC · original
One RTX 5080 Series X run beyond the first cell on
c24462e, withVICTORY_AMBIENT=0.6. Windows 11, driver 621.24, Ryzen 7 9700X, fresh runtime cache,VICTORY_SHADER_LOOP_LIMIT=256andVICTORY_LEVELS_ON_DEMAND=1. The only local code change was a diagnostic controller for movement and camera input. The log confirmed the replacement at 2560×1440.From the cell we followed Wilson through A102, reached the office interview, then the robbery flashback. The bunk frame, wall drawings, common-room phones and interview desk were readable. Wilson’s face and beard rendered beside Lucia in the same shot, while most of her face was missing. In the office reverse shot the portrait on the computer screen was visible, while the two characters’ 3D faces were largely missing. Direct sunlight on the flashback counter looked washed out. Some floor tiles missing on entry appeared later.
The transition into the flashback took 97.36 s for a separate 32-frame interval. These are ambient-on observations from one run. Measuring the cost of the pass would take a matched ambient-off run. Stopped deliberately at the counter. AI-assisted local test.
@tippythetaidum on GitHub · 2026-11-25 18:40 UTC · original
Tested on an NVIDIA card, an RTX 5080 16 GB (driver 621.14, Windows 11, Series X profile). With
VICTORY_AMBIENT=0.6the prison's rooms are lit from the first gameplay frame, the same as on your 7900 XT.Build: release build of
mainca8829fwith #24, #927, #823, #606, #1002, #907, #834, #1007, #1031 and this PR'sc24462e, which picked cleanly. Two 600-second runs with the same switches, the frame-rate set plusVICTORY_HEAP_WORKER=1andVICTORY_LEVELS_ON_DEMAND=1, without and withVICTORY_AMBIENT=0.6. The log hasindirect light is replaced by a constant (VICTORY_AMBIENT) level=0.6 width=2560 height=1440once, and the pass never said it did nothing.Picture, saved frames of the same shots:
Cost: none measurable. World median 5.6 fps without and 5.8 fps with (25th percentile 4.1 and 5.1). No errors and no device loss.
What it doesn't change: Lucia's irises still show a blue-violet tint, and the counselor's sunglasses reflect a blue sky with clouds indoors. That's specular, not diffuse, so I'm looking at whether it comes from the reflection programs #823 lets run on NVIDIA, not from this pass.
AI-assisted (Claude Code, Claude Opus 5.5). Descriptions and counts only, nothing from the game attached.
@HrHd on GitHub · 2026-11-25 19:18 UTC · original
Measured from a second install, not from a port: DexNom/VIctory's RT preview (VICTORY_BVH_BUILDER=1 VICTORY_BVH_QUARANTINE=0 VICTORY_ACTIVATE_RAYS=1 VICTORY_RT_RESOLVE=1) does restore the fill this constant stands in for - daylight, sun and shadows where we otherwise have a flat dark frame.
Cost on an RTX 4060 Ti at 1080p-in, 8-bit out, 4068 draws/frame: 704-721 ms and ~350 draws a frame dropped with "a stage of the ray-tracing ..." without a host pipeline. Their plain renderer is 833-1000 ms at ~5.0k, so in this build the RT path is cheaper than their non-RT one but ~3x our own 260-311 ms.
So the constant is the right call for speed, and the RT preview is worth keeping as a fidelity reference for whatever the real fill becomes.
@Exopus-0x65f7ad0 on GitHub · 2026-11-25 19:43 UTC · original
Tested on RTX 5060 Ti 8 GB, Series S, fork
maind510ee4plus a stack of fork PRs. WithVICTORY_AMBIENT=0.6, the cell's walls, bunks, ceiling lights and posters show instead of black. Same build, A/B: median 8.6 fps with and without it, so no measurable cost. Some surfaces facing away from the window stay black (bunk sides, a shelf).🤖 Generated with Claude Code
@HailLucifer666 on GitHub · 2026-11-25 22:42 UTC · original
/keereview — a clearly-labelled stopgap with a device-lifetime problem in its cache.The cache.
static PASS: OnceLock<Option<Pass>>holds a root signature, a PSO and a 1024-slot descriptor heap built from the first device, for the life of the process. This crate has device-lost paths (theDeviceRemovedreporting indraw), and after a recreate those three objects belong to a dead device — using them is the kind of thing that shows up as a device-removed loop rather than a clear error. Thelevel()cache is fine (an env var does not change); this one needs to be keyed to the device, or cleared when the device goes.The hook is untested.
replaceis the part that matters — resolving root parameter 1 / dword 176, checkingDXGI_FORMAT_R32_UINT, reserving a view slot, setting the three bindings, dispatching — and it has no test. The three tests cover two pure helpers andmake, andmakeis itself device-optional, so on a machine without a device "3 passed" can mean two. A fake-host test of the slot arithmetic ((slot * step)on CPU and GPU handles) would catch the arithmetic that a debug layer would otherwise only catch on hardware.Worth stating in the body:
d3dcompiler_47.dllbeing present at runtime (D3DCompile), which this project otherwise only needs for tests;VICTORY_AMBIENTis read once, so it cannot be turned off in a session;host_pipeline/host_roots/host_heapsbut says nothing about the title's own root signature, which the pass replaced withSetComputeRootSignature.The honesty about limits is exemplary — the "not tested: Windows, NVIDIA, anything past the first room" line is exactly what a stopgap PR should carry, and the switch being off by default is the right call.
@Filip722 on GitHub · 2026-11-26 08:04 UTC · original · edited 2026-11-26 08:55 UTC
On the RTX 5060 Laptop GPU (8 GB) with GE-Proton11-14 and vkd3d-proton, this patch on our Series S integration selected the NVIDIA device but failed
ambient::tests::ambient_pass_buildswithE_FAIL.On the same runtime, routing the unchanged shader body through a DXC-backed compiler and serializing the root signature separately made all three ambient tests pass, including real D3D12 pipeline creation. The signature used four 32-bit constants at b0 and a one-entry UAV table at u0. The title then invoked the pass at 1280×720 and reached controllable prologue gameplay. At
VICTORY_AMBIENT=0.6alone the room was still dark on this setup. The Windows reports with on-demand texture levels are a separate configuration.Reproduced and tested with Codex (GPT-6.2-Sol High) assistance.
@UwUCammie on GitHub · 2026-11-26 14:04 UTC · original
@HailLucifer666 I moved the pass onto
Hostinedde28c4. The root signature, pipeline and descriptor heap now belong to the device that created them. A new test checks CPU and GPU offsets for the first, second and last heap slots, with the GPU handle above 4 GiB. The dispatch invalidates the saved compute bindings so the next title dispatch binds its root signature again.@Filip722 I reproduced
ambient_pass_buildsreturningE_FAILon an RX 7900 XT with Wine’s default compiler selection. On the same prefix, selecting the installed natived3dcompiler_47.dllwithd3dcompiler_47=n,bmade all four tests pass, including creation of the actual D3D12 pipeline. I haven’t verified that override on the 5060 Laptop. The ambient level is read at startup and needs a restart to change.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.