Skip to content

Latest commit

 

History

History
611 lines (568 loc) · 92.2 KB

NOTES.md

File metadata and controls

611 lines (568 loc) · 92.2 KB

SplitSecondVR - developer notes

Seated stereo VR for Split/Second (Black Rock Studio, 2010; Steam app 297860, build 385319), a sibling of BlurVR (..\..\Blur\BlurVR, notes in its own repository, https://github.com/TwoAyEm/BlurVR; a local copy of its modules lives in source/blur_reference/, which is not part of this repository). Status (2026-10-20): stereo menus and races run in the Index (phases 0-4 mostly done). Sections 1-6 are the Phase 0 analysis, 7-7m the build-up in the order it happened, section 8 what is left.

1. Verdict (from the game files, before any run)

Feasible. The game is a 32-bit Direct3D 9 (SM3.0) deferred renderer that imports only d3d9.dll!Direct3DCreate9, so the BlurVR proxy approach applies unchanged. Everything below was read from the install, no game code was run or modified.

  • SplitSecond.exe (23 MB, linked 2010-05-05): no ASLR/DEP, not large-address-aware (2 GB). On disk .text, Stext, Sdata are encrypted (Steam stub .bind + SecuROM: .securom, paul.dll, dishp.dll, dfe). Imports: d3d9, d3dx9_42 (texture loading, D3DXCompileShader*), binkw32, FMOD (event + ex), DInput8, XInput1_3, ws2_32/wsock32, user32/kernel32/...
  • SecuROM DFE unpacks five shader archives to %TEMP%\SplitSecond_Data_DFE\data_dfe_* at run time (same format as the .ark files).
  • Settings: Documents\Disney Interactive Studios\Split Second\config_ss.cfg (65 bytes, binary; 0x69239f97 -> 1920, 0xe21008e6 -> 1080 are the width/height dwords - a guess to confirm by saving another size).
  • Hardware of the development machine: Valve Index (90 Hz; SteamVR default 2468x2740 per eye), RTX 3060, i7-11700K, 32 GB.

2. The .ark format (tools/ssark.py)

Header {u32 0x10000, u32 table_end, u32 count, u32 0x10}; count 20-byte entries {f0, name_hash, flag, offset, size} sorted by hash, offsets chain without gaps; blob = u32 uncompressed_size + Okumura LZSS (4096 ring, F=18, T=3, ring zero-filled, write position N-F, flags LSB first, 1 = literal; match = pos = b1 | (b2 & 0xF0) << 4, len = (b2 & 15) + 3) when flag == 1, stored otherwise. Content kinds seen: <Root XML (powerplays, timelines, cameras, splines), !dir text tweakables (FoVStart = 50.0 (5.0, 90.0);), CXF\0/RDHS/IRDS shader and effect containers (D3D9 byte code with CTAB), SXET textures, GFX\x08 Scaleform GFx 8 (Flash) UI, FEV1 FMOD events. python tools/ssark.py ctab <ark-or-folder> [--grep NAME] lists every shader constant with stage, register set, register and count.

3. What the shader constant tables say (resident.ark: 46,212 shaders, 972 constant names)

constant where meaning / what the VR renderer does
TransViewProj VS c33-c36, in 22,460 VS the one camera matrix of a pass (world matrix separate: Trans c24-26, NormalTrans c28-30) -> X' = X*inv(P)*C*P_eye per eye
WorldCameraPos VS c19, PS c15 camera position (specular, fade, sky, scattering) -> per-eye position
WorldCameraFront, ObjectCameraFront/Right/Up VS c17, c20-22 billboard/camera axes
View (c12, 3 regs), ViewProj (c8, ps c4) particles, a few others X*C
*InvViewProj PS c100 / c65 / c106: deferred_lighting, Light_Deferred_*, GenerateLightMask, SSMask_matInvViewProj, sslighting_matInvViewProj, ss_water_runtime_fInvVP world position from depth -> run the pass once per eye with inv(VP_eye) and the eye's scissor
QuadRenderer_FrustumCorners VS c25 full-screen rays (Blur-style per-eye corners)
Light_Deferred_*_LocalViewProj, deferred_lighting_LocalViewProj VS c64/c68 light-volume transform
TiledLighting_PerTileLightDesc VS c29 x64 CPU-built per-tile light lists: check at run time whether the PC path uses it
ShadowMap_*, SSMask_* PS c73-c118 cascaded shadow maps + screen-space shadow mask; cascades are fitted to the game camera frustum
vignette_*, LensFlare_*, LightShafts*, ScrVelBlur_*, SimpleMotionBlur, MotionBlurNoisePass, MB_matMotion360 PS/VS assume one centred mono image: skip for VR
LogLuminance/ExpLuminance/ToneMapper_AveLum PS auto-exposure over the whole side-by-side image: fine, both eyes share the exposure
vertexTextureSkinning_*, DeformVertexPosition_* VS s0/s1/s2 vertex-texture skinning / damage deform: view independent
ParaboloidEnvMap_*, ReflectionMap_*, PodReflection_* PS car env maps (view independent), planar reflections (per eye)

Not found in any shader: view matrices in the material pixel shaders (unlike Blur's road shaders) - good for stereo.

4. Cameras, UI, movies

  • Camera modes: Chase, Bumper, Bonnet (/RaceSetupHUD/..., SS1_BonnetCam). FOV is data-driven and speed dependent (FoVStart/FoVEnd, vertical, clamped 5-90). Power Plays use UseCinematicCamera; camera shake tunables exist (Camera Shake Scale, SpeedShake, ...). Bonnet/Bumper is the VR default to test.
  • UI = Scaleform GFx 8 (136 GFX\x08 files in resident.ark), statically linked: draws can only be told apart structurally (back buffer target, alpha blended, no depth).
  • Movies (Bink via binkw32): intro bootup\disbr.bik 1280x720 17.7 s, intro.bik 1280x720 69 s, season\* 1280x720, tutorials\* 1280x720, demo\*; movies\screens\** are 256x256..640x352 loops used inside the menu UI (not full-screen movies).

5. Phase 0 build (this code): src/ modules

module role
dllmain d3d9.dll exports (forwarded), DllMain (config, log, import patches), Direct3DCreate9 (optionally an IDirect3D9Ex)
core, config log file, SplitSecondVR.ini
d3d_hooks real d3d9 loading, vtable patching, vtable indices
display_modes extra resolution entry, V-Sync switch, CreateDevice/CreateDeviceEx, CheckDeviceFormat log (from BlurVR)
device_hooks device vtable hooks: every call forwarded after the probe sees it; Ex-device managed-pool remap (from BlurVR)
texture_pitch lock-pitch fix for textures moved out of the managed pool (from BlurVR, unchanged)
window_spoof window-size handling (from BlurVR; saved size read from config_ss.cfg; logs window creation)
iat_hooks kernel32 CreateFile/LoadLibrary and binkw32 BinkOpen/BinkClose import patches: file, module and movie log (new)
ctab generic shader constant-table parser, shader hash (new)
probe shadow state, resource inventory, shader registry, per-second stats, scheduled/hot-key frame captures, shader summary (new)
blur_reference/ (a local copy, not in the repository) keeps BlurVR's remaining modules (stereo scene, screen-space passes, HUD, VR runtime, culling hook ...) for the next phases;
blur_reference/tools has its analysis helpers (dis.py, ctab.py, hotpath_check ...).

Smoke test without the game: a 32-bit harness that loads the proxy, creates a device, creates the game's own data\shaders\*.ovs/ops, draws, resets and presents 300 frames (plain and Ex device) was run: hooks, captures, shader parsing, Reset, managed-pool remap and the pitch fix all work. Lost-device note: after a failed Reset the runtime stops dispatching through the patched vtable, so nothing is logged until a Reset succeeds.

5b. First run in the game (2026-10-19): SecuROM and the proxy

  • Three launches with all hooks on crashed deterministically about 1 s in, after SecuROM opened splitsecond.exe, dfa.dll and dfe: access violation, write to address 0 at SplitSecond.exe+0xF179CD (image base 0x400000, so RVA 0xF179CD, inside SecuROM's Stext section), identical in every run (minidumps in %LOCALAPPDATA%\CrashDumps).
  • Bisect by ini switch (game started through steam://rungameid/297860, 40 s each): Passive=1 runs; window hooks only runs; device hooks only runs; LoadLibrary-only runs; Bink-only runs; CreateFileA/W import patch crashes - even a pure pass-through hook that logs nothing. So it is the changed import address, not what the hook does: SecuROM checks the executable's own CreateFile imports (it uses them to read the exe and the dfe container) and crashes on purpose when they are not kernel32's.
  • Fix: the CreateFile patch skips the executable and SecuROM's modules (paul.dll, dishp.dll, dfa.dll, FirewallInstallHelper.dll); it is still applied to the other modules (binkw32, d3dx9_42, fmod ...). With that, everything else on runs: movie opens are seen through BinkOpen, settings and some files through the other modules' CreateFile. The game's own archive reads (exe -> .ark) are therefore NOT visible by this route; level/loading detection must come from Direct3D behaviour and Bink events (or a different mechanism that leaves the exe's imports alone). Design rule for every later hook: patch Direct3D vtables and non-protection modules only.
  • Seen in the log of the working run: device created fullscreen 1920x1080 A8R8G8B8, flags MULTITHREADED | HW_VP (not PURE), no auto depth buffer (the game makes its own), V-Sync on (interval 1); Direct3DCreate9 is called three times (two probes at start-up, the real one ~10 s later after SecuROM/Steam); shaders, vertex/index buffers and textures are created on loader threads (so every table the mod keeps needs a lock); the intro runs at 30 fps with 6-18 draws a frame; intro.bik and disbr.bik are 1280x720 at 30 fps; free address space was ~1.1 GB at the intro (2 GB process limit).

6. Phase 0 results (first played session, 2026-10-20, 1920x1080 fullscreen, default options) - the checklist answered

  1. Starts with the proxy: yes, once CreateFile is left alone in the exe (section 5b). Window, device, LoadLibrary and Bink hooks are all accepted.
  2. Device: plain IDirect3DDevice9, flags MULTITHREADED | HW_VP (not pure), fullscreen A8R8G8B8 1920x1080, interval 1, no auto depth. Loader threads create shaders, vertex/index buffers, textures, cube and volume textures while the render thread draws (thread note: lines) - every table the mod keeps needs a lock. CheckDeviceFormat(INTZ) succeeds and the game uses INTZ depth textures (readable by shaders) next to ordinary D24S8 surfaces. A Direct3D 9Ex device (SharedTransport=1) works: managed pool remapped, the staging fix for small mip pitches is used (Bink's 256x256 textures), the game runs through the intro and menu (tested with V-Sync forced off as well).
  3. A race frame (capture 04, 1132 draws, 3,200 lines per frame; pass sizes are for an 1920x1080 back buffer):
    step targets notes
    env maps 768x384 A8R8G8B8 + INTZ, two 384x384 viewports ReflectionMap_* constants: the car's dual-paraboloid environment map, view independent
    G-buffer 3 x A8R8G8B8 + INTZ at 3840x2160 (MRT), ~370-470 draws the main camera; one TransViewProj per draw
    shadow cascades 1024x3072 A8R8G8B8 + INTZ, three stacked 1024x1024 viewports rendered after the G-buffer; 100-300 draws each
    small 512x512 A16F4
    lighting / HDR 3840x2160 A16F4 + INTZ, 135-190 draws (13-105 with TransViewProj) light volumes, sky, transparents
    2880x1296 A16F4 1-2 draws letterboxed (20:9) intermediate; see open questions
    exposure / bloom 16x16 R32F x18, 480x270 A16F4 x5, 960x540 auto-exposure chain, bloom, tone map to A8R8G8B8 3840x2160
    HUD 3840x2160 A8R8G8B8 + D24S8 (stencil used, CLEAR S), 35-200 draws; Scaleform offscreen 512x288 D24S8 drawn into the supersampled picture
    resolve StretchRect 3840x2160 -> 1920x1080
    back buffer 4 shader-less (vs=0 ps=0) blended quads drawn right after Present in the capture's numbering (probably overlays/fades over the next frame's back buffer)
    The race renders at twice the back buffer in each direction: 3840x2160 for 1920x1080. The menus use 1:1 (1920x1080). The game has shader anti-aliasing modes
    (AntiAliasing2X_Accuview, ..2X_Quincunx(Alt), ..4X with offsetMSAA, ColorOnly), and 4X is a 2x2 supersample: that is the factor. A VR back buffer of 3840x2160
    (side by side) would make the game render 7680x4320 internally, so the game's QUALITY option (Low/Medium/High, the only graphics option besides resolution, V-Sync and brightness) has to be Low (to be confirmed by the second
    session; the options screen has no separate anti-aliasing choice), or the mod must keep the internal targets at the back buffer size.
  4. TransViewProj is the object's world x view x projection (it changes with nearly every G-buffer draw), not a camera constant. Layout: the four registers c33-c36 are the rows r0..r3 of the clip transform (clip.x = r0.p ...), r3 = r2 + (0,0,0,1), i.e. a projection with c = 1, d = -1 (z_ndc = 1 - 1/w, near = 1, infinite far, not reversed). For one draw |r0.xyz| = 1.0825, |r1.xyz| = 1.9241 (ratio 16:9, vertical FOV about 54 degrees) - x and y scales of the game camera projection (a, b). The stereo rewrite is X' = X * inv(P_old) * C * P_eye as in BlurVR, which needs P_old per pass: take it from a pass constant (a, b, c=1, d=-1 known), from the first rigid draw, or from the previous frame's pure view-projection (the *InvViewProj constants of the lighting passes). Trans (c24-26) is probably the world matrix; the capture now dumps it (see below).
  5. Menu: a real 3D scene (240-565 draws, 144-281 with TransViewProj, the same G-buffer pipeline at 1x) over Bink backdrops (256x256 fe_mm_generic*.bik, 640x352 episode*.bik / fe_evs_track*.bik used as in-UI pictures). So menus can be rendered in stereo like a race.
  6. Loading / movies: the intro is disbr.bik (17.7 s) then intro.bik (69 s), both 1280x720 30 fps, drawn with 5 draws a frame. Between the intro and the menu the game creates its whole menu target set in one go (a few ms, ~60 render targets). The race load creates the 3840x2160 set (about 02:48 in that log) and a loading frame rate of ~30 with 142 draws. The game's own archive reads are not visible (exe CreateFile cannot be patched); level detection must use Direct3D behaviour.
  7. Bink: BinkOpen/BinkClose import hooks work: name, size, frames, fps are logged; flags 0x4400 / 0x6400.
  8. Address space: free virtual memory 1.1 GB at the intro, 0.96 GB in the menu, 0.55-0.65 GB in a race at 1080p (managed textures hold the rest). The Ex device (managed -> default pool) should lower this use; to be measured in the second session.
  9. Frame rate: exactly 30.0 fps everywhere (intro, menu, race) with V-Sync on, and 30 fps in the intro with V-Sync forced off (a movie, so inconclusive). An internal limiter (the exe imports only timeGetTime from winmm) is likely; the second session tells whether the race stays at 30 with V-Sync off. This matters for VR: the compositor will reproject 30 fps to 90 Hz.
  10. Scaleform UI options seen in the GFX files: VSYNC_ON/OFF; the AA modes are effect files (GERF). config_ss.cfg holds only the window size and two floats (1.01): the graphics options are in the profile _54776f4179456d.sav (57 KB) - a copy was taken before the next session to find the anti-aliasing setting by diffing.

Open questions for the second session (settings: SharedTransport=1, ForceNoVSync=1, in-game Quality = Low)

  • internal target sizes with Quality Low (1920x1080 expected) - and what else Low changes (shadow cascades, effects), race frame rate with V-Sync off, does Present block (timing: lines);
  • the Trans / NormalTrans / WorldCameraPos registers of a G-buffer draw (capture shader descriptions), the 2880x1296 pass, the fixed-function quads after Present;
  • free virtual address space in a race with the Ex device;
  • the diff of the .sav file for the Quality option (to see how it is stored).

7. Phase 1 status (2026-10-20): VR runtime and the stereo core

vr_runtime (src/vr_runtime.cpp): a compositor thread owns the OpenVR session (retries every 5 s for 10 minutes until SteamVR and the headset are ready), loops on WaitGetPoses, publishes the head pose, places the virtual screen and submits either a dark scene layer or the latest stereo picture; the game thread (VrOnPresent, before the real Present) copies the back buffer through an X8R8G8B8 render target (opaque alpha) into a ring of 3 A8R8G8B8 textures shared with a Direct3D 11 device (D3D9Ex shared handle, OpenSharedResource), waits for an event query, and publishes the slot. Flat frames (intro, loading, movies, anything without duplicated draws) go to the virtual screen overlay (2.6 m wide, 2.2 m away, [VR] settings); stereo frames are submitted per eye (bounds 0..0.5 / 0.5..1) with Submit_TextureWithPose and the pose they were rendered with, so the compositor resubmits a 30 fps picture at the headset's 90 Hz and reprojects it for head rotation. [VR] Headless=1 replaces OpenVR by a plain D3D11 device (no headset needed): the copy, the shared handle and the dumps (Num5 final picture, Num6 G-buffer 0-2 and the HDR target) can be tested on any machine. Live test on the Index: session up, overlay shown, stereo scene submitted (the compositor made 960x1080 eye textures), no submit errors.

stereo (src/stereo.cpp): see the comment in stereo.h. Every draw whose vertex shader has TransViewProj and that targets the main render size (the size of the 3-target G-buffer pass, learned from that pass) is issued twice with scissor = left / right half and c33-c36 replaced by R_e * M (R_e = P_e * C_e * inverse(P)), the game's constants and scissor restored afterwards. a, b come from each draw (|r0.xyz|/|r3.xyz|, |r1.xyz|/|r3.xyz|), the depth offset delta = r3.w - r2.w (1.0 world, ~0.25 near parts, -0.25 sky). C_e = inverse(head pose in the game's camera space * eye-to-head) with the OpenVR (right-handed, -Z) to game (left-handed, +Z) conjugation; the head pose is read once per frame. Verified by dumps in headless mode on the 3D main menu / episode scene (docs/stereo-gbuffer-albedo-sbs.png, docs/stereo-menu-sbs-final-frame.png): proper left|right pair, crossed disparity for near objects (left eye image displaced right), nothing mirrored, 100 % of the draws duplicated, no matrix shape failures. The lighting of the HDR pass looks right in the menu scene. Known gaps (next): the HUD / UI is drawn once over the whole side-by-side picture (Phase 3; first fix in 7b: a panel of its own); bloom, vignette, lens flare, motion blur and light shafts are computed on the side-by-side picture as if it were one image (Phase 2); WorldCameraPos (c19) is not moved to the eye yet (specular, sky dome); the per-eye resolution is half the back buffer width (1920x1080 back buffer = 960x1080 per eye: pick a bigger mode with CustomWidth/CustomHeight, e.g. 3840x2160 with Quality Low so the game renders 1:1); races not tested yet (cascaded shadows exist at High quality). Quality High renders 2x2 supersampled: for VR use Low (or find out what Medium does).

7b. First headset feedback and the UI panel (2026-10-20)

User in the Index: "3D is good, but the overlay message (press Enter) is not visible, and the menus are a bit close".

  • UI pass -> HUD panel. The game's UI (Scaleform, ps_2_0/vs_2_0, DrawPrimitiveUP / DrawIndexedPrimitive) is drawn straight into the finished picture's render target (1920x1080 A8R8G8B8, the same one the post pass wrote) with a D24S8 depth-stencil bound (stencil = masks), blend states 5/6 (SRCALPHA / INVSRCALPHA) or 5/2, and COLORWRITEENABLE 7 (RGB only). In the stereo frame that picture is the side-by-side pair, so "PRESS ENTER TO START" sat across the seam, in the nasal edge of both eyes. stereo.cpp now sends that pass to a transparent texture: after the game's SetRenderTarget(0) / SetDepthStencilSurface a main-size A8R8G8B8 target with a main-size D24S8 depth-stencil in a stereo frame (a duplicated draw so far) is swapped for the HUD texture (VrHudTarget, a ring of 3 shared textures like the picture's, cleared to 0x00000000 on the first request of a frame); separate alpha blending (ONE / INVSRCALPHA) accumulates coverage, and COLORWRITEENABLE gets the alpha bit while redirected (the UI draws with RGB only: without it the layer had alpha 0 everywhere - found in the first headless dump). The game never sees the swap (the probe's shadow state, and GetRenderTarget (hooked, vtable 38) return its own target; it is put back when the game ends the pass: SetDepthStencilSurface(NULL), another SetRenderTarget, or Present). The finished stereo picture no longer contains the UI; the VR runtime shows the HUD texture as the overlay splitsecondvr.hud (premultiplied, [VR] HudWidth/HudDistance/ HudHeight/HudCurve) placed like the virtual screen (yaw-only in front of the head, F9 recentres) and hides it in frames without a UI pass. Flat frames (intro, loading) keep the UI in the picture and use the screen overlay. Dump: Num5 also writes SplitSecondVR_hud_NN.bmp. Headless mode redirects too (no overlay), so it can be verified.
  • Menus further back. UpdateEyes moves the viewer back along the game camera's view axis ([VR] MenuPullBack = 2 m in menus, RacePullBack = 0 in races) and the virtual screen / HUD panel default to 3 m (3.6 m wide, same angle as before). Menus vs races: the near-plane depth offset of the world draws (delta, see stereo.h): menu scenes use ~0.25 (sky -0.15), races ~1.0 (the sampled captures: menus 0.0-0.5 only, races 0.5-2 only); per frame the duplicated main-size draws vote, a new kind must hold for 8 frames (SceneKind=1/2 forces one). (First try: the 1440x648 particle pass - wrong, the menu scenes have smoke too.) Race camera FOVs vary a lot per frame (37.8 - 73.2 deg; menus 50 / 54 / 60 deg) - harmless, the remap replaces the game's projection by the headset's. The pre-race cinematic cuts between both kinds, so the pull-back jumps then.
  • Still mono / wrong in stereo (Phase 2): per-eye InvViewProj lighting (point lights and shadows reconstruct positions with the game's single camera), bloom, vignette, lens flare, motion blur.

7c. First races in stereo (headless run, unattended: Enter through the menus; 2026-10-20)

  • Races render correctly in stereo: clean left | right pair, parallax on the road / buildings / near cars, 100 % of the main-size draws duplicated, 30 fps, 0 odd matrices. The diegetic HUD (position / lap text under the car, power-play icons) is drawn by the scene itself and is duplicated with it; the Scaleform HUD of the first seconds is almost empty (a logo in the corner), the HUD panel stays transparent. Pre-race cinematics (hangar, flyovers) work too but use rolled cameras: a comfort problem (Phase 4).
  • Fixed after the first race dumps: (1) frames with few scene draws (the pre-race tutorial: 3 draws) were taken for flat frames (threshold 20 duplicated draws) and their side-by-side picture was shown on the flat screen; a frame is a stereo frame with >= 1 duplicated draw now; (2) cinematic cameras use other aspects (b/a 1.695 vs 1.778): the guard is 10 %.
  • The low-resolution particle pass (1440x648 at 1080p: DownSampleDepAndCol2x2 of the depth + colour, then StandardParticle_* billboards, composited into the HDR picture later) is the main camera at 3/4 x 3/5 scale: its draws are duplicated per eye into the halves of that target when the target is HDR (A16F4) with a depth texture (INTZ), smaller than main, and the draw's a / b match the main camera's (the reflection pass 512x512, mirrors and shadow maps are other cameras and stay as they are). Billboards still face the game camera, not each eye (ObjectCameraRight/Up, c20/c22): negligible.
  • Still mono in races (Phase 2): the 512x512 reflection pass and what samples it, bloom / vignette / motion blur / light shafts (computed on the side-by-side picture), the deferred lights' InvViewProj, WorldCameraPos (c19 VS, c15 PS). Full-screen black fades and letterbox bars come out of the UI pass as black rectangles on the HUD panel (Phase 4: dim the scene instead). Free address space in a race is ~620 MB at 1080p: keep an eye on it when the resolution goes up.

7d. Headset session 3 and the culling hook (2026-10-20)

User: "lots of culling issues (expected), ran well, good frame rate, HUD readable and in the right places; some odd visual behaviour in the initial 3D loading screen".

  • Findings from the log of that session: 11 F9 recentres in 13 s on the title scene (the view of that first 3D scene was probably off - to ask); the race detector flickered (menu <-> race, near-plane votes: a race frame with many near-plane draws; fixed: a frame is a race with >= 16 draws of the race kind); Power Play camera effects animate the projection aspect (b/a 1.0 - 2.6 in a second): the aspect guard is gone for main-size draws; a few draws with depth offset 0 (backdrops): the remap no longer uses inverse(P).
  • Why the culling is wrong: the game culls with its camera's frustum (vertical 20-73 deg, menus 50-60) - the Index needs ~110 x 105 deg per eye, so everything outside the narrow frustum (above and below the road, the edges) is never submitted. Only the game can be asked to draw more.
  • Where the game keeps its camera (camera_scan.cpp, Num7 with [Probe] CameraScan=1; observation only): a scan of the process for [a 0 0 0 | 0 b 0 0 ...] found the camera object in the game's 128 MB heap arena: view matrix (4x4 with garbage w column), projection at object+0x158 (row-vector layout, m22 = f/(f-n) = 1.0005 menus / 1.00008 races, m23 = 1 hence a real far plane: 500 / 1000-12500), view-projection after it; other copies are Direct3D write-combined upload memory (protect 0x404) and the cascades' own projections (same a, b, other near / far). The game rewrites the matrix every frame (the speed-dependent field of view), so patching the matrix itself is useless; a hardware write watch (CameraWatch=1) logged the writer: the function at exe+0x10AAF0, BuildProjection(ecx = camera, [esp+4] = out): it stores identity-like values, then a = 2 / [ecx], b = 2 / [ecx+4] (the width and height of the view plane at distance 1, 2*tan(half angle)), the near / far planes come from [ecx+0x50] / [ecx+0x54]. The function right before it returns the vertical fov from [ecx+4] (fld [ecx+4] ; fmul 0.5 ; fld1 ; fpatan ; fadd st0,st0). Debug registers did not bother SecuROM (69 threads armed, no crash).
  • The hook (debugregs.cpp, cull_hook.cpp; [VR] CullWiden=1, CullMargin=0.3, CullToggleKey=0x60 = Num0 to compare live): DR2 = execution breakpoint on the builder (after checking its first bytes: 8B 44 24 04 0F 57 C0 F3 0F 10 0D, F3 0F 10 15 - another build of the game is left alone), no code is patched. At each build the main camera's two floats are raised to the headset's field of view plus the margin (3.69 x 3.43 at distance 1 = 122 x 118 degrees): the game's culling, object matrices and cascades follow. The main camera object is found from the frame's builds: the one whose output matrix holds the a / b of the frame's main-camera draws and has m22 ~ 1 (a far far plane); it changes with the scene (menu -> race) by itself. Our stereo remap reads a, b from every draw, so it simply sees the wide projection. Measured (headless, same pre-race camera path, A/B with Num0): ~20-25 % more scene draws per frame with it on (the airport is open: much of the extra frustum is sky / ground), 30 fps unchanged.
  • Not done: head turns. The frustum is centred on the game camera's axis, so turning the head by more than (frustum - headset) / 2 (~10 degrees at the margin above) shows culled areas. The next step would be to turn the game's camera with the head (rotate the view matrix stored before the projection at BuildProjection time, undo it at Present, and drop the head rotation from the remap's C_e) - which also makes billboards / view-dependent shading follow the head; needs the view matrix's layout and a check that the game does not use it as state.

7e. The 2D layer on the title screen (headset session 3 feedback, 2026-10-20)

User: lens flares / highlights of the 2D overlay do not line up with the scene behind, shadows on the text do odd things, the smoke behind the text is missing.

  • The title's UI pass (capture of frame 1500): text glyphs (blend 5/6 = SRCALPHA/INVSRCALPHA), then 11+12 draws of 512x64 / 512x512 / 512x256 / 128x128 DXT5 textures with blend 5/2 (SRCALPHA / ONE = additive) - the flares, light streaks and glows - some behind stencil masks. In the HUD texture every draw used the coverage rule for alpha (ONE / INVSRCALPHA), so additive layers darkened the scene behind the panel instead of adding light (flares as dim blobs, smoke / glows "missing", odd shadows). Fix: per UI draw, when the game's blend is additive (ONE or INVSRCCOLOR as destination) the alpha factors are ZERO / ONE (alpha untouched, premultiplied compositing then adds the colour); otherwise ONE / INVSRCALPHA. UiNoteDraw also logs each distinct UI blend state once ("stereo: UI draw blend: ...") to see what else exists.
  • Alignment: the HUD panel was placed along the head's yaw when the panels were last placed (session start, F9, dashboard events) while the stereo scene is drawn relative to the seated zero pose, so the two only coincided after a recentre (explains the F9 spam on that first scene). The panel is fixed on the scene's own forward axis now: seated (0, HudHeight, -HudDistance). The flat virtual screen (intros / loading) still faces the head's yaw.
  • Still open for alignment: the panel's angular size (3.6 m at 3 m = 62 x 35 degrees) vs the game camera's field of view (menus 50-60 degrees vertical = 80-95 horizontal) and the 2 m menu pull-back: 2D highlights meant for 3D cards line up exactly only for panel half-angles tan = 1/a, 1/b scaled by z0 / (z0 + pull-back). A per-scene panel size is the next knob.
  • Could not be tested yet: the display fell back to 640x480 (the game sees one display mode and CreateDevice fails with 0x80070057 before the proxy can do anything - the log shows GetAdapterModeCount -> 1, earlier runs 26); needs the monitor / display output back.

7f. Missing smoke / mist on the title (2026-10-20)

User: the white-purple mist rolling behind the logo (visible in the game's own picture) was black in VR. Reproduced headless: smoke particles and the mist were missing with the new eye-matrix formula of 7d (M' = P_e * C * [r0/a; r1/b; r3; (0 0 0 1)], exact homogeneous 1) and back with the first one (4th row = (r3 - r2) / delta, through inverse(P)), over repeated captures. Cause not found (the two differ only in the homogeneous coordinate: ~1 for the world, 1 - (m22 - 1) * z / delta for far points, i.e. less eye / pull-back translation for far geometry); the first formula is the default again ([VR] LegacyRemap=1; 0 = exact, kept for research). Culling widening (CullWiden) is off by default: the user found it crops more of the 3D debris on the title (a draw count difference of the effect itself is likely: debris is culled by the game with its own, then wider, frustum). The blend states seen in the title's UI pass: SRCALPHA/INVSRCALPHA, SRCALPHA/ONE (additive), stencil-only; the main menu adds DESTCOLOR/ZERO (multiply) draws.

7g. Menus in stereo: lights, rays, soft particles, floor reflection (2026-10-20, headset + headless feedback)

Rule of thumb that explains most of it: every pass that rebuilds a world position or a view direction from the game's single camera has to be run per eye (section 3 table), and anything the game does in screen space with the game camera's matrices must use the eye's. What was done, in the order the symptoms came up:

  • Local lights (RunLocalLight, [VR] EyeLights=1): the deferred light volumes use their own matrix (deferred_lighting_LocalViewProj, VS, row-vector layout) and the pixel shader rebuilds the position with sslighting_matInvViewProj. Both are replaced per eye (scissor halves). Fixed lights that did not line up between the eyes. The "ghost" cards of the carousel were not a bug: they are the game's own dark neighbour cards, compressed by the pull-back.
  • Full-screen passes with corner rays (RunQuadRays, EyeRays=1): QuadRenderer_FrustumCorners (VS c25, world rays, corner order BR, BL, TR, TL) is rebuilt from each eye's matrices; the camera's view -> world rotation (g_Rcw) is taken from those rays and reused for the eye positions (EyeOffsetWorld).
  • Soft particles: the cloud / smoke pixel shaders fade against the scene depth (StandardParticle_SceneDepthTex), which is the game camera's depth: on the title it carved a dark logo-shaped hole into the mist, and in the menus the cards cast "shadows" into the clouds. In menu scenes those draws get a 1x1 R32F texture holding 1.0 (far) instead (g_softDummy, MenuSoftParticles=0). Race scenes keep the fade.
  • Clouds behind the cards: the same draws get D3DRS_DEPTHBIAS = MenuCloudBias, so a sprite nearer than the far carousel cards does not show through them. The bias has to grow with the viewing distance: 0.02 was enough at 2 m pull-back, at 3 m the smoke covered the cards (the "pale cards"); 0.5 is the default now.
  • Menu camera: MenuPullBack (3 m now), MenuLift (0.2 m, +Y of the game camera), MenuHeadMove=0 (in menus only head rotation moves the view; the card names are glossy highlights that cropped when the eye moved sideways), RacePullBack 0.
  • Floor reflection (the menu floor, material PodReflection_*; shaders disassembled with DumpShaders=1 + D3DDisassemble):
    1. A 480x270 A16F4 + INTZ pass drawn before the G-buffer renders the scene mirrored about the floor plane with the main camera's a, b. MenuReflections=2 draws it per eye into the halves of that target (1 = as the game draws it: smeared fans; 0 = none).
    2. The floor's pixel shader finds its texel like this: V = normalize(WorldCameraPos(c15) - pos), n from the normal map, R = V - 2(n.V)n, t = c100.w / dot(-R, planeN) (c100.w = 0.3: a proxy plane 0.3 above the floor), p' = pos - t R, then B = w p' + (1-w) reflectedCameraPos(c102) with w = c101.w = h / (h + 0.3), h = the camera's height above the floor (checked on two camera heights). B is the floor point whose mirror image contains p' (= pos for a flat normal), and the lookup is uv = project(PS ViewProj c4-c7, B) into the mirrored picture. So the reflection is consistent only when c15, c102 and ViewProj all belong to the same camera as the mirror picture: per eye that is EyeCameraPos=3 (bit 0 = the eye's position into WorldCameraPos, bit 1 = the eye's position mirrored in the plane into c102) plus the remapped PS ViewProj (floorVp in StereoRunDraw). c101.w is left as the game computed it for its own camera (the error is a few centimetres).
    3. Why it pinched when the viewer was moved away from the game camera: the PS ViewProj was remapped with the "legacy" 4th view row (r3 - r2) / delta. For a vertex matrix, which multiplies object-space points (a few metres), that is harmless, but the floor shader applies it to world positions ~800 m from the origin: the float noise of r3 - r2 (5e-4) over delta (0.15) times 800 m turns the homogeneous coordinate into about -1.6 instead of 1, and the eye translation (3 m of pull-back) is multiplied by it - an 8 m error in the eye's depth. The reflection lookups landed in the wrong place (a dark floor with a red smear). The PS ViewProj uses the exact row (0 0 0 1) now. To remember: a remap that is applied to world-space points must not use the legacy row (the vertex path still does, see 7f).
    4. Research aids kept: floor: log lines (constants, remapped rows, eye offsets; the first 12 samples), and Num6 also dumps the texture bound at sampler 12 (SplitSecondVR_refl_NN.bmp).
  • Per-eye WorldCameraPos (VS c19 / PS c15) is set from EyeOffsetWorld for every duplicated draw when EyeCameraPos & 1.

7h. Stability: freezes and the end-of-race hang (2026-10-20)

  • Watchdog (watchdog.cpp): when no Present happens for 4 s (and again at 15 s) it logs every thread's EIP and a rough module+offset stack (WATCHDOG: lines). First use: the VR thread held texLock during Submit (which can block); the lock is held only to pick the texture up now (the picture is AddRef'd).
  • End-of-race freeze: the game thread was parked in vrclient.dll -> d3d11.dll (an OpenVR overlay call - SetOverlayTexture / ShowOverlay / HideOverlay - made from the Present hook) while the scene flipped from race to results. All overlay calls moved to the compositor thread: the game thread only publishes what it wants (wantHud, wantScreen, AddRef'd textures ovHud / ovScreen, hudWidthDirty, under texLock) and ApplyOverlays() in VrThread makes the OpenVR calls once per loop. VrReleaseDeviceResources clears the wishes instead of calling OpenVR. One race to the results screen has run through since: keep watching.

7i. Test tooling (scratchpad scripts, not in the repo)

run_title.ps1 (headless: starts the game through Steam, presses Enter through the intros, Num5 / Num6 dumps; -Menu 1 goes on to the main menu) and run_cfg.ps1 (sets the ini keys MenuPullBack, MenuLift, EyeCameraPos, MenuCloudBias, MenuReflections, runs that and converts the dumps to PNG). [VR] Headless=1 (no headset) renders with a 64 mm IPD and Index-like tangents; set Headless=0 again afterwards (the scripts set it to 1). SBS frames are 1920x1080 = 2 x 960x1080.

7j. Resolution

The back buffer is split in two: 1920x1080 = 960x1080 per eye, while the Index's SteamVR default is 2468x2740 per eye, so the picture is soft. [Render] CustomWidth / CustomHeight adds one more entry to Options > Graphics > Resolution (pick it there once; the game saves it). Quality must stay Low (High renders 2x2 supersampled: a 2560x1440 back buffer would mean 5120x2880 targets). The limit is the 32-bit address space: free VA was 0.45-0.65 GB in a race at 1080p (free VA in the once-a-second stats: line), and all the main-size targets (3 G-buffer + HDR + depth + the HUD ring + the shared ring) grow with the area. 2304x1296 (1.44x the pixels) is the cautious step, 2560x1440 (1.78x) the next; 3840x2160 (4x) is probably too much. Measured (2026-10-20, user, Index + RTX 3060): 3840x2160 with the game's Very High detail was "very playable": the log shows a 3840x2160 back buffer, the race G-buffer at 7680x4320 (the 2x2 supersampling of the higher quality settings), 30 fps held, free VA falling from 900 MB (menu) to ~470 MB late in the race, no WATCHDOG lines. So address space is not the limit at this size; the game's own 30 fps cap and the 3060 are fine with it. (2304x1296 on High rendered 1:1, i.e. the quality setting's supersampling depends on the mode.)

7k. Per-eye post effects (2026-10-20)

The post chain of a race (capture splitsecondvr_capture_05, 3840x2160 back buffer, 7680x4320 supersampled targets): auto exposure (16x16 chain), bloom (bright pass to 1/8 size, 13-tap gaussians: local, fine on a side-by-side picture), tone map + bloom add, motion blur (replaced by a copy, 7i), lens flare (1/4-size target: source sprites with TransViewProj and blend_using_ztex_SceneDepth, a radial mask, two blurs, two "aberration" ghost passes, a final blend), colour cube + gradient + vignette, then the UI.

  • Vignette (RunVignette, PS 1e1d8578 ss_gradient_and_vignette_*): a circle around the centre of the picture from the second texcoord with sspostprocessing_uvOffsetAndScale (c110: xy offset, zw scale) and vigParams (c109: x, y scale the centred coordinates, z / w inner / outer radius). On the side-by-side picture the centre is the seam. The pass is drawn per eye (scissor halves) with c110 = (offset.x + 0.5 e * scale.x, offset.y, 0.5 scale.x, scale.y) and c109.xy scaled for the half's shape and raised so the corner distance stays; the picture itself is read with the first texcoord, untouched. [VR] Vignette: 1 per eye (default), 0 none (inner radius 100), 2 as the game.
  • Lens flare (RunFlareGhosts, flareSrc in StereoRunDraw; [VR] LensFlare 1 / 0): the source sprites are ordinary TransViewProj draws into the quarter-size A8R8G8B8 target (no depth; recognised by the pixel shader's blend_using_ztex_SceneDepth, the size and the main camera's a / b) and go through the normal per-eye remap into the halves. The ghost passes' vertex shader projects the flare's world position (kFlarePosAngle xyz, a far point) with a 3-register ViewProj (c8-c10: x, y, w rows); per eye it gets the rows of P_e * C_e * [r0/a; r1/b; r3; (0 0 0 1)] (exact 4th row, as in 7g). Not changed: the ghost passes' fade with the distance to the picture's centre (kModGradient) is still centred on the seam. Not verified visually: no sun was in view in the unattended test.
  • Light shafts (LightShafts*) never showed in a capture: untouched.

7l. Cinematic bars and fades, head-locked (2026-10-20)

The race intro's black bars and the black fades are Scaleform quads in the game's 2D layer, so they used to land on the HUD panel as black rectangles. Research: [Probe] UiResearch=1 logs every UI draw with pixel shader ecc66c37 (shaders, mvp = VS c0..c1, cxmul / cxadd = PS c2 / c3, texture bound or not). Findings (3840x2160 and 2880x1620 alike, the 2D stage is 16:9 and maps to NDC with x scale 6.58e-5, y scale -1.17e-4):

  • The cinematic bars are two untextured quads (caf48d57 + ecc66c37, colour multiplier white, vertex colour black, alpha blend 5/6), each 0.2549 of NDC high: the top one hangs from yo = +1.0 (draw it down), the bottom one stands on yo = -0.745. At rest each covers 12.75 % of the picture height (confirmed with the HUD dump's alpha channel). They slide out by yo growing / shrinking (+0.0104 per frame at the start, accelerating). The pause menu's, the menus' and the tutorial dialogs' frame bars are the same shapes with a 256x256 gradient texture (tex1) and half the y scale (-5.5e-5, so a taller quad), at yo +0.9977 / -0.748: they are taken as well (first version left them on the HUD panel, so the dialogs still had black rectangles). Rule: caf48d57 + ecc66c37, alpha blend, colour multiplier white, no additive part, x scale 6.2e-5..7.0e-5, xo ~ -1, y scale -1.25e-4..-4.5e-5, and if textured then |yo| >= 0.7.
  • Fades: full-screen black quads, colour multiplier (0 0 0 a) and no additive part (cxadd), x / y scale as above, yo ~ 1.0. (Seen for a few frames at the race start; the flashes with cxadd > 0 and a growing quad at the countdown are not fades and stay.)
  • UiLetterboxDraw (called from UiNoteDraw) recognises both, drops them from the HUD texture and notes this frame's bar fractions (g_lbTop, g_lbBottom: fraction of the picture height; top = (1 - (yo - 0.2549)) / 2, bottom = (yo + 1) / 2) and the fade (g_fadeKeep = product of 1 - a).
  • ApplyLetterbox (in StereoOnPresent, before the picture is copied for SteamVR) draws them into the back buffer: per eye (halves of the side-by-side picture) black ColorFill rectangles from the top / bottom edge. The eye images are in tangent space, row = (up - tan) / (up + down) * height; the cinematic window is the tangent range +-(right - left) / (2 * 2.39) around the head's forward direction (2.39 = the game's 16:9 / (1 - 2 * 0.1275)); the bars' depth is strength * (bar / 0.1275) * (up - window) rows, so a bar sliding out of the game's picture also slides out of the eyes. Because the eye textures have no depth of their own the bars sit at infinity, identical in both eyes. [VR] LetterboxStrength scales the depth (1 = a 2.39:1 slit in the Index, 0.5 = half). The fade is a black alpha quad over the whole back buffer (DrawFadeQuad: fixed function, a state block saved and restored, only the original device entry points so the proxy's shadow of the game's state stays valid).
  • Side bars (LetterboxSides=1, LetterboxSideScale): the window is not as wide as the headset's view but as wide as the HUD panel (half width tangent = HudWidth / 2 / HudDistance, times the scale) with the cinematic aspect for its height - i.e. the area the game's own picture occupies on the panel, so text and bars of the 2D layer line up with it. Left / right bars close and open with the same animation parameter as the top / bottom ones (they move outwards as the game's bars slide out). Their widths per eye follow the eye's asymmetric field of view. LetterboxSides=0: only top / bottom bars, window as wide as the view, height (right - left) / 2.39.
  • HUD lock ([VR] HudLock): the HUD panel is normally fixed at (0, HudHeight, -HudDistance) in the seated space, because the race HUD labels hang over the cars and have to line up with the picture. Cinematics, the pause menu and the tutorial dialogs have no such labels, so HudLock=2 (default) switches the panel to SetOverlayTransformTrackedDeviceRelative (HMD) at the same place while the game's bars / a fade are up (StereoLetterboxActive, published with the other overlay wishes, applied on the compositor thread: g.hudLocked, log line "the HUD panel is locked to your head now"); 1 = always locked, 0 = never. Not tested in the headset (headless has no compositor).
  • Keys: [VR] Letterbox (1 = head-locked bars, 0 = they stay on the HUD panel), LetterboxStrength (1.0), LetterboxSides (1), LetterboxSideScale (1.0), HudLock (2), Fades (1); research [Probe] UiResearch, FadeTest (0..1, dims every frame to check the fade drawing).
  • Tested headless: the intro's bars become the 2.39:1 window in both eyes (frames at 50 % dim with FadeTest as well), the game runs on after the fade quad. Not yet tested in the headset; a fade triggered by the game itself was not caught (the research log shows only flashes), so Fades is verified by FadeTest only. Other cinematics (replay, finish) may have bars with other sizes: UiLetterboxDraw only takes quads with the stage-wide x / y scale and the 0.2549 height of these.

7m. Head-aware culling (2026-10-20)

The widening of 7d (CullWiden) made the game's camera view plane as wide as the headset's field of view around the car camera's axis, so a head turn of more than the margin still looked into culled space, and it was off because it cropped debris on the title. Now:

  • CullHeadAware=1 (default): HeadFrustum (cull_hook.cpp) takes the four corner rays of each eye (tangents left / right / up / down), turns them with the eye-to-head transform and the head's pose (seated space = the game camera's frame, camera looks along -Z), and measures the largest angle from the camera axis in x and in y over both eyes; plus CullMarginDeg (8, the head moves between two frames: ~240 deg/s at 30 fps) on each side, capped at 80 degrees (a 160 degree view plane: extents up to 2 * tan 80 = 11.3). The result is held and decays by 7 % per frame, so a head that comes back does not thrash the culling. CullHeadAware=0 is the old fit (headset FOV + CullMargin tangent).
  • CullWiden=2 (the default; the code default had slipped to 1 in the release clean-up and was put back on 2026-10-22): only while the scene is a race (StereoIsRace()); in menus the game's own frustum stays (the title's debris is culled with it). 1 = everywhere (old), 0 = off.
  • Research setting [Probe] FakeHeadYaw / FakeHeadPitch (degrees, headless only; yaw positive = to the left) gives the headless mode a turned head (VrGetPose).
  • Measured (headless, head turned 40 degrees to the left, race start): the picture with the widening shows the palm, the banner and the lamp left of the airport that the game's own culling leaves out; draws per frame in the same (stationary) place ~1100 against ~935 with the game's culling (+17 %), the frame rate stays at the game's 30 fps and the free address space is unchanged (>= 640 MB). Not tested in the headset. Cascaded shadows follow the main camera's frustum too (they were fitted to it before as well): shadow quality at 160 degrees is not checked.
  • Not done: the 512x512 reflection pass is still culled by its own camera.

Camera turn (CullTurn, added after the headset test of the widening: looking fully round, the world behind you disappeared and cars popped in beside you)

A symmetric frustum can never cover the rear (the widening above is capped at 160 degrees), so in races the game's camera itself is now turned to the head's orientation (CullTurn=1):

  • Where the view lives (hardware write watches + a memory scan, research settings removed again): every frame the game copies its camera object (Matrix44 assignment at exe+0x5600), rewrites its view from a 3x4 (exe+0x100ED0), calls BuildProjection (our breakpoint), then writes the view-projection. The camera object (view at +0xD8 with a clean w column, a copy at +0x118 with garbage in w, projection +0x158, view-projection +0x198) is the one BuildProjection gets (g_main), but the draws do not read it: a scan of the process's memory for its view finds two more camera objects in the heap (one is g_main - 0x5E8), and turning those - not the main one alone - turns the picture. (Turning the 3x4 source of the view assignment crashes the game: it is a stack temporary.)
  • TurnCamera: V' = V * Q (row vectors, Q = the head's orientation in the game camera's space, from the pose at the last Present), written to the view and its copy; for the two other objects also the view-projection recomputed from their own projection. Every build of the main camera does it once per frame; a check (orthonormal rows, clean w column, copy equal) keeps it off anything that is not a camera. The scan (ScanForViews, ~0.4 s, a hitch at a race's start) runs after 3 frames without the turn, when the camera objects still hold the game's own view, and again when the main camera object changes or no extra object validates for 20 builds (CullTurnExtra=0 skips them: then nothing follows the head).
  • The game builds its camera after the draws of a frame (Present -> build -> first draw -> Present in 25 ms), so the turn applied in frame N shows in frame N+1's draws: CullTurnRotation() returns that rotation, and UpdateEyes uses the head relative to it, R_c^T * H (rotation and translation), so what is rendered is the head's view at the pose of the draws; the compositor gets the pose it was made for as before. The frustum is then just the headset's field of view plus CullMarginDeg (12) around the turned camera.
  • The 2D layer of the race (icons over cars) is computed for the turned camera, so the HUD panel locks to the head while the camera follows it (HudLock=2, CullTurnActive()).
  • Headset report after the first version: "still culling when looking behind; moving the camera with the right stick shows it fine". Findings since (headless, can not repeat it there): the draws of a frame see the camera built in that frame (a test that turned the camera in every other frame only: even frames unturned, odd frames turned), so CullTurnRotation() now returns the rotation of the current frame's build (it was the previous frame's: a one-frame error in every head movement); the main camera's extents were widened but the camera objects the draws use kept the game's own field of view (a 0.8-1.2, b 1.4-2.1 against the widened 0.38 / 0.43), and a histogram of the directions of the drawn objects ([Probe] CullResearch, cullstat lines, removed again) showed the culling follows those objects: with CullWidenExtra=1 their extents and projection a, b are widened too (the objects at 60-90 degrees from the axis went from ~1000 to ~9000 per second); CullPredict=1 looks one frame ahead along the head's last turn (the pose is taken at Present, the camera built ~15 ms later and shown ~40 ms after that; limited to 20 degrees per frame and to consecutive frames); the periodic log line now tells how many turns succeeded and the largest head turn between two frames. If it is still wrong in the headset: the log has turn: main .. ok / .. failed, largest head turn .., the camera objects' extents (other .. extent .. projection a b), and the race / menu flips of the scene detector (each one switches the camera turn off for a second or two).
  • Second headset report: the world behind was still missing, and the in-game look-back is complete (three Num5 captures at the same spot: forwards, the game's own look-back, a head turn looking back). The game's look-back shows the road curving on behind with a rival car and the skyline; the head turn showed the road ending ~100 m back (a V-shaped gap with water behind it), no skyline, no car. So what is drawn is chosen from the game's own camera before the render copies exist: track sections, cars and the rest are not touched by turning the copies the draws read. Camera class (exe+0x38B630 = operator=, the camera's view computed by exe+0x10BF80 from its position +0x10 and its 3x3 orientation +0x20, rows of 4 floats): each frame the controller's camera G0 is copied into the scene camera S and that into the main camera R (g_main); R's view is then recomputed from the copied orientation, S's and the later copies' views come from G0's view (computed before the copy). Fix (CullTurnNode=1, default): a breakpoint on operator= turns G0 before it is copied into S (OnCameraCopy: S is known as the source of the R copy one call later): the orientation as N' = C Q^T C N (C = diag(-1, 1, 1): the game's view 3x3 is the transpose of C N) and its view as V' = V Q (and the view-projection recomputed), plus the widened extents; everything copied or derived from G0 in that frame follows, as with the right stick. G0 is refreshed by the controller every frame (logged: the orientation before the turn does not accumulate), so nothing is restored. Headless (FakeHeadYaw = 180 / -110): the road behind runs to the horizon with the gantry and sunset, buildings to the side are complete, no voids (the earlier runs had dark navy holes where road tiles were culled). The older path (turning R, S, O1 and their view-projections at the projection build, CullTurnExtra) stays as the fallback for the first frame of a race, before S is known.
  • Third round (the head turn made things better, but cars, items and the world were still cut off at a distance; the in-game look-back is complete). A once-a-second dump of the game's camera object G0 (g0dump, research) showed that the in-game look-back changes nothing in it but the transform (no mode flag), so what the game uses to decide what to draw has to come from further upstream. Chain (found with write / read watches and disassembly): the camera controller's state is assigned (a 0x544-byte memcpy, exe+0xAC2F0) into the per-player struct (stride 0x660, camera state at +0x440: position, three axes at +0x450 / +0x460 / +0x470 = the rows of the camera's orientation, fov +0x480); the scene builder (exe+0xB8DD0) makes a local camera from it and SetCamera(i, cam) (exe+0x394B60, an array of cameras with stride 0x2F4 at [0xD66000] + 0x68) assigns it into G0, G0 into S, S into the main camera R; and several other systems (exe+0xB355B, 0xA89EF, 0xBBA23 ... one reads the axes to copy them) read the per-player state directly. CullTurnNode=2 (default) turns that state itself: a breakpoint on the assignment's entry records the return address and re-arms the same debug register there (DrRetarget, this thread), and right after the assignment A' = W * A is written into the three axes (the state is rewritten completely by every assignment, so nothing accumulates; the controller's own camera is untouched). Everything that reads the camera afterwards - the scene's cameras, views, culling, track, cars - sees the head's direction, as with the right stick. Only the extents of G0 are still widened separately (state mode: OnCameraCopy). Mode 1 (turn G0 before its copy into S) and the render copies (R, S, O1) remain as fallbacks for the frames before the state is known. Headless (FakeHeadYaw=180): backward views with the road, buildings and aircraft tail fins in the distance, no culling holes. Not tested in the headset yet.
  • Research settings [Probe] FakeHeadYaw / FakeHeadPitch / FakeHeadSweep (degrees, degrees per second; headless) and CullTestYaw / CullTestFlip (a fixed camera turn, uncompensated, alternate frames) stay in the code.
  • Measured (headless, [Probe] FakeHeadYaw = 180 / 40 degrees, CullTestYaw fixed-yaw test mode with no compensation to see the draws follow): turned 180 degrees the picture shows the road, buildings and sunset behind the start grid; at 40 degrees the palms / banners / lamps to the left are all there; 29-30 fps, ~1345 draws per frame, free address space >= 650 MB. Not tested in the headset.

7n. The sky dome (2026-10-21, headset report: "the skybox doesn't come down enough, the horizon leaks void and tears like solitaire, the parallax is off")

The sky is one draw (VS f45b34ee, PS 154613ac with the constants Sky_0_brightness / Sky_0_colourtex, ZENABLE on / ZWRITE off, 448 triangles): a mesh of radius ~5 m around the camera (its TransViewProj has a ~1/250 scale, the vertex shader decodes the packed positions) that is meant to look infinitely far. Any translation of the eye relative to the camera - the eye separation (32 mm), head movement, a pulled-back viewer - moves it like a nearby object: its rim lifts off the horizon (void between the sky and the far ground, uncovered pixels keep old frames = the "solitaire" trails) and its parallax is wrong. Test: RacePullBack=4 showed the dome's inside (a tunnel-like city) with the old code and a normal sky with the fix. Fix ([VR] SkyAtInfinity=1, default): for draws whose pixel shader has Sky_* constants (ShaderInfo::isSky) the per-eye matrix uses the eye's orientation only (C_e with its translation zeroed). Also seen in those frames: a thin dark band at the very bottom of the eye images when pulled back / looking down (clear colour; probably ground close below the camera that the game never draws): not looked into.

7o. Per-eye motion blur (2026-10-21)

The game's blur pass (PS ff186290, constants MB_matMotion360 = 32 4x4 matrices in c96..c223, MB_motionBlurParams c94) reads the picture's alpha as a motion id, takes M[id] * (x, y, depth, 1) as the pixel's place in the previous frame (perspective divide) and blurs along the difference, 9 taps. On the side-by-side picture with one camera's matrices it is wrong in both eyes. [VR] MotionBlur=2 draws the pass once per eye (scissor halves) with M_e = Q_e * (R * T) * Q_e^-1, T = Pg^-1 M Pg (the view-space motion of the game camera, Pg its projection from the last main-camera draw), Q_e = P_e * C_e (EyeProjection * eye matrix), and R = Qc^T * Qp (this frame's applied head turn vs the previous one) removing the head's own rotation, which the head-turned camera carries in its matrices; head movement is never blurred because the eye pose relative to the camera is the same in both frames. MotionBlurStrength (0.5) scales c94.y. Blur taps near the seam can sample the other eye (accepted). Headless race frames (the first runs only saw the pre-race cinematic: the test script's Enter presses paused / left the race - fixed with -Skip): driving shows road / kerb streaks with a sharp car and sky, both eyes alike; with FakeHeadSweep=40 (up to 7.5 degrees per frame) the sky, buildings and palms stay sharp, so the head's turn is not blurred. Headset A/B (same track, 30 fps cap): MotionBlur=2 costs about 2-3 ms per frame (race mean 28.4 fps, 56% of seconds under 29.5, vs 29.6 fps and 7% with MotionBlur=0), felt as dips to 25-28 fps; so the default stays 0 and 2 is opt-in. The cost is probably the blur itself (9 taps at 7680x4320, the same pixels as the game's one full-width pass), not the per-eye split: the game's own blur (1) should cost about the same. Possible savings: half-resolution blur, skipping near-static pixels, a GPU timer to measure it.

7p. Frame rate: the game's limiter and a runtime 60 fps patch (2026-10-21)

Limiter: a method at exe+0x158880 adds the last frame's time to an accumulator, and while it is below the frame time (float at exe+0x7A0C14, 1/30) calls Sleep for the rest (call ebx at exe+0x158945, returns to exe+0x158947); the number of simulation ticks it hands to the game is 2 per frame time. Found with [Probe] SampleGame=1 (samples the game thread; it crashed the game once in the camera-copy breakpoint, so research only). [Render] UnlockFps=1 hot-patches kernelbase's Sleep (padding + short jump, no exe byte) to return at once when called from there: the game then runs faster than real time (menus 5x), a measurement mode (frame_unlock.cpp). The community 60 fps patch (the user's NoobPatcher/SplitSecond.NoobDiff, not run, only read) halves ten float constants (VAs 0xBA0C14 1/30 -> 1/60 = the frame time; 1/60 -> 1/120 in six places; 1/120 -> 1/240; 1/15 -> 1/30; 1/30 -> 1/60) and doubles the result of fmul [esp+0x18] at exe+0x4D3D75 (after a piecewise-linear curve lookup, exe+0x179220) through a helper in padding. All ten "original" values match our exe; the code-cave bytes differ on disk because the protected .text is encrypted there. [Render] TargetFps=F (fps_mode.cpp; later replaced, see 7u): the ten constants are checked (and the code at the site), then scaled by 30/F in memory; an execution breakpoint on the multiplication scales its operand by F/30 (debug register 1; with the head-aware culling the register first watches the camera builder to learn the player state, then DrRearm hands it to the multiplication while a race runs and back when it ends). Headless race at 60: constants applied, 9600 hits per 10 s (8 cars x 120 ticks/s = real time held). Headset (medium quality, 3840x2160 main size): race median ~56 fps, p10 47, dips only in the start-grid / power-play cinematics; free address space shrinks race by race (615 -> 399 MB over three races).

7q. Clean-up for a release (2026-10-21)

The settings were cut down and the research tools removed; the tree before this is the commit "Runtime 60 fps mode (TargetFps)" (4a48710, branch fps-mode), which still has them.

  • The shipped ini (source/release/SplitSecondVR.ini) has four keys: [General] Enabled, [VR] Stereo, [VR] MotionBlur (built-in default 1 = per eye; the shipped ini says 0 = off on purpose so the option is visible, deleting the line turns it on: check_ini_defaults.py lists it as an intentional difference), [Render] TargetFps (default 60). Stereo replaced [VR] Enabled and the old Stereo: 0 = the plain game (no SteamVR session, no D3D9Ex device - SharedTransport is no key any more, it follows Stereo - and CullWiden forced to 0); with Stereo on CustomWidth / CustomHeight default to 2880x1620 and ForceNoVSync to 1. Log defaults to 0, MenuPullBack / MenuLift to 3.0 / 0.4. tools/check_ini_defaults.py checks that every active key of an ini equals the compiled default.
  • No ini key any more (fixed values in config.h): Letterbox / LetterboxStrength / LetterboxSides / LetterboxSideScale / Fades (all on, 1.0), MenuHeadMove 0, MenuSoftParticles 0, MenuReflections 2, MenuCloudBias 0.5, MenuSkipShaders (removed), DumpKey2 = Num6, the probe switches (all hooks on, Passive 0, CreateFile in the exe never, Num8 / Num9 captures; the automatic captures are gone and the scheduled shader summary is only written with Log=1), SkyAtInfinity (always on), LegacyRemap (always the first formula), [VR] Enabled (old).
  • MotionBlur is 0 / 1 now (1 = per eye, what 2 was; the game's own blur on the side-by-side picture, the old 1, is gone: it is wrong in both eyes, and Stereo=0 leaves the game's blur alone). The pass is only drawn at High quality and up, not at Medium (headset test, two races in one log: the per-eye line first appears in the High one; High with the blur held ~50 fps, Medium 60).
  • Removed code: UnlockFps (frame_unlock.cpp, the kernelbase Sleep hot-patch: TargetFps replaces it; any value, e.g. 240, scales the same way), the game-thread sampler, DumpCodeRva, the camera scan (camera_scan.cpp, Num7), CullResearch / CullTestYaw / CullTestFlip / FadeTest / UiResearch / DumpShaders and their blocks. Kept for testing: [VR] Headless, Ipd, FakeHeadYaw/Pitch/Sweep.
  • GitHub: .github/workflows/build.yml (windows-latest, Python 3.12, pip install ziglang==0.16.0, source�uild.bat nodeploy, tools/make_release.py, tools/check_release_zip.py, artifact SplitSecondVR-zip; a pushed tag v<SSVR_VERSION> also creates the release with the zip), the same as BlurVR's (see section 22 of BlurVR's notes). The zip has one folder SplitSecondVR\ with d3d9.dll, openvr_api.dll, the small ini, README.txt, install.bat, uninstall.bat and the OpenVR licence; no source. Not run on GitHub yet (the tools were run locally). The working ini of the PC (SplitSecondVR.ini in the mod folder) is no longer tracked (.gitignore).

7r. Light shafts (2026-10-21): never drawn

The shaders exist and are created in every session (a bright pass, PS 36f59644 with LightShaftsBrightPass_Threshold / Scale / ShaftTint: sat(scene - threshold) * scale * tint; and four tone-mapper variants that add the shafts texture, scene * (1 - sat(shafts)) + shafts: PS f2db333a, 990e1b20, 0bd343dc, 8002c568, all at the same UV, so nothing in the composite needs a per-eye centre). The step between (the radial / directional blur that makes the streaks from the sun's screen position, which is what would be wrong in stereo) is not identified: no shader constant has a shaft-like name. None of the 454 captures of earlier runs draws any of these shaders. A diagnostic (ShaderInfo::isShaftBright, probe.cpp: with Log=1 the first bright-pass draw logs "light shafts: the bright pass is drawn" and starts a capture) did not fire in a handful of races at Medium, High and Very High (main sizes 3840x2160 and 5760x3240). So the effect is not drawn on the tracks / settings tried; nothing to make per eye so far. If a track ever logs the line, the capture has the whole chain.

7s. Enabled=0 and the copy protection's LoadLibrary hook (2026-10-21)

Observed: with the proxy DLL in the game folder and Enabled=0 (no hooks at all) a race took 270 s to load instead of 80 s (no DLL, or the proxy enabled), the GPU idle and one core busy. Found by bisecting the enabled start-up pieces (each alone was slow; import hooks + Direct3D hooks was fast, and then only the LoadLibrary hooks, and then only in d3dx9_42.dll): SecuROM puts a function of its own (SplitSecond.exe+0xEBCA00) into the LoadLibrary* import slots of several modules; d3dx9_42.dll calls LoadLibraryA all the time while a level loads (the shader compiler, d3d9.dll), and with an unsigned d3d9.dll in the process that hook is very slow (the busy thread's stack: d3dx9_42 -> exe+0xEBCA00, heap / string work, GDI, wintrust / crypt32 loaded). The enabled proxy was fast by accident: InstallImportHooks writes its own wrapper over the slot (a frame poll after the device exists, because d3dx9_42 only loads then), and the wrapper calls kernel32 directly. Enabled=0 now runs StartLoadLibraryBypass (iat_hooks.cpp): a thread that sets d3dx9_42.dll's LoadLibrary slots back to kernel32's functions whenever they point into the executable (every 250 ms for a minute, then every 2 s). Measured with race_probe.ps1 (Enter through the menus until the GPU 3D load > 20 %): no DLL 85 s, proxy enabled flat 80-85 s, Enabled=0 before 266-270 s, after 80 s. The README promise of Enabled=0 is now true except that the DLL is loaded (and the workaround runs).

7t. Where the frame time goes (2026-10-21, timing probe: Num7, perf.cpp)

perf.cpp times, with Log=1 and Num7, per frame: GPU time per phase from Direct3D timestamp queries (a mark when the phase or the pixel shader changes; the draws of the reduced-size passes one by one), and the CPU time of our draw hook against the real draw calls. Phases: other (shadow maps, cube maps), gbuf (the stereo-duplicated geometry pass), lights, main, reduced, ui, mod (our work at Present), idle. Headless race, High quality (main 3840x2160 side by side), RTX 3060, TargetFps=60: GPU busy about 7 ms of the 16.7 ms frame (gbuf 2.3 ms for ~580 draws each drawn twice, lights 0.9, main 1.7, shadow / other 1.2, ui 0.4-0.8, our Present work 0.5); CPU per frame: our hook 0.4-0.9 ms, the real draw calls 0.4-0.8 ms, Present 0.5 ms. So the stereo duplication and the proxy are cheap (about 2-3 ms of GPU and under 1 ms of CPU); nothing in them is worth micro-optimising. The rest of the frame is the game waiting: the GPU sits idle for ~10 ms at the start of each frame (the interval of the 4th half-size draw, the fixed-function draws into the back buffer, which really is the gap before the next frame's shadow passes) while the CPU runs the game's simulation and the limiter. Checked by changing the pace: at the game's own 30 fps that interval grows to 27.5 ms; with TargetFps=120 the game only reaches 55-69 fps (one thread 54 % busy, another 26 %) because the simulation ticks 4 times a frame (each tick 1/240 s with the 60 fps patch's constants: 240 ticks a second, about 2 ms of CPU each by this estimate): the patch's finer simulation costs CPU in proportion to TargetFps. Two back buffers (BackBuffers=2, tried and removed) changed nothing. Flat (Stereo=0) at TargetFps=120 stays at 60.0 fps because the game's own V-Sync is then not forced off (the monitor is 60 Hz). Not measured: the real headset at the user's resolution (Very High, 5760x3240 main), where the GPU part is larger; the probe is for that.

7u. 60 fps: one simulation step per frame (2026-10-22; [Render] Use60Fps, replaced TargetFps)

Reason: the community patch's way (section 7p: all ten constants halved, two steps of 1/120 s per frame) runs the engine at 120 steps a second: twice the vanilla simulation work and, in the user's headset test, a gate that opens in about 4.8 s took 2.6 s and jammed shut (step-counted animations ran twice as fast). The vanilla engine does 2 steps of 1/60 s per 1/30 s frame (60 steps a second). Use60Fps=1 keeps that: only the three frame-time constants are halved (exe+0x7A0C14 1/30, 0x7C3F30 1/15, 0x7EF378 1/30; the six 1/60 and the 1/120 constants are step lengths and stay; all ten are still checked, that is the build check), so the limiter asks the game for 2 steps per 1/60 s frame time, and the step count it hands to the game is halved to 1. The hand-over is a virtual call (push esi; call eax at exe+0x15899B) on the current game-state object: the limiter (exe+0x158880) is a base-class method used by eight state classes (vtables 0xBA2AA4, 0xBA3110, 0xBA32DC, 0xBA3398, 0xBA3518, 0xBA36A4, 0xBA3894, 0xBA38C0: the only places that hold the base method 0x413530 at +0x8). The first attempts failed instructively: a debug-register breakpoint handed back and forth with the culling missed frames (the game ran at double speed in between), and a stub in one vtable was never called in a race because the state objects change (found with a one-time breakpoint that logged each object's vtable: intro, menus and race are different classes). Each vtable's +0x14 slot (the state's update function) now points at a 40-byte stub of ours, generated at run time, that halves the count when its return address is the one after that call and jumps on to the original; no debug register and no code byte change, and if fewer than 8 stubs can be installed the frame time is left alone, and an 8 s check puts the constants back if no stub was ever called (the game would otherwise run at twice its speed). The stubs' counters are logged every 10 s ("60 fps: the limiter handed the game N step counts ..."). The multiplication hook of the patch (exe+0x4D3D75, section 7p), the scaling for other rates (72, 90) and the debug-register hand-over in the culling hook are gone. Measured (headless stereo race): the limiter is called 60 times a second asking for 2 steps and the game gets 1: 60 steps of 1/60 s a second; main thread CPU over 10 s 4.9 s against 5.5 s for the patch's way (about 0.9 ms per step); 60 fps. Headset: the gate animation is right (about 4.8 s including lowering); the other timers have not all been checked.

7v. Menu reflection fell back to the mono draw (2026-10-22)

Headset / frame-dump report: in the menus the floor reflection sometimes sat shifted towards the seam (left eye right, right eye left) or flashed black while the head turned. Cause: the quarter-size reflection pass was only duplicated per eye when its projection scales matched the main camera's of the last frame within 0.5 %; the widened culling (7m) changes the scales every frame while the head turns (and the reflection camera is built at another moment, log: b 0.1774 against 0.1763), so the pass was drawn plain, once for the whole side-by-side target. The menu reflection pass (quarter-size HDR target with depth, not in a race) now skips that comparison: the remap uses the pass's own projection anyway. Verified in headless frame dumps (sharp, aligned reflections in both eyes). The fire / smoke sprites that show when the head turns away in the quick race menu are the game's own (they stay with CullWiden=2 too: its particles are not frustum culled, only off screen in the 4:3 view).

7w. Real headset, 3840x2160: High against Very High (2026-10-22, Num7 probe, RTX 3060, Index)

Back buffer 3840x2160 (side by side), race start, motion blur on. The probe's "fixed-function draw into the back buffer" interval (11.5 ms at Very High, 10.6 ms at High, whatever the resolution) is the game's idle gap (7t), not GPU work; it shows up in reduced at Very High (its target is half the main size) and in main at High. Without it:

  • High (main 3840x2160): GPU work ~10 ms (other 1.3, gbuf 2.4, lights 1.5, main ~3.4 with the per-eye motion blur 1.45 ms, ui 0.2, mod 0.8). The race still runs at 47-52 fps (frame interval ~20 ms): the GPU is about half idle, so the limit is the game's CPU side (simulation + draw submission + limiter; the proxy is under 1 ms, Present 0.6 ms). Not yet looked at: what the game thread spends those 20 ms on.
  • Very High (main 7680x4320, 2x2 supersampling): GPU work ~22-31 ms (gbuf 3-5, lights 3.7-8.9 growing as the race starts, main ~11 with the motion blur pass 5.8 ms, particle composite 2.5), 29 fps, SteamVR reprojecting; free VA ~600 MB (fine). No visible quality gain over High in the headset (user's test).
  • Menus at either setting hold 60 fps. A once-only 9 ms spike in the mod's Present work (the copy for SteamVR) was seen. Settings chosen for the 1.0 README: High at 3840x2160 (or the 2880x1620 extra mode on weaker cards); faster GPUs can afford Very High.

7x. The retail release (D:\Games\Split Second): shader hashes (2026-10-22, version 1.1)

The same build 385319 code (every hook site and the 60 fps constants check out) but its shaders are not byte-identical to the Steam copy's: the bars' vertex shader hashes 3aaae556 there, caf48d57 on Steam, while the instructions are the same. The cinematic bars and fades were recognised by that whole-shader hash, so on the retail release the bars at the race start were missing (drawn into the HUD texture instead). ShaderInfo::codeHash is the same FNV over the instruction tokens only (comment blocks - the constant table and the compiler's text - left out); the bars (vertex shader code hash fd7ab434, pixel shader a015a399) and the research UI skip groups use it now. Everything else is matched by constant names or addresses. Headless check on the retail install: "the game's cinematic bars are drawn as head-locked bars" at the race start; the camera turn / culling hooks run as on Steam (user: culling fine).

7y. OpenXR as the other way to the headset (version 1.2, [VR] Api=openxr)

Ported from BlurVR's openxr_runtime.cpp (BlurVR NOTES 27), reshaped for this mod's compositor-thread design. vr_runtime.cpp keeps everything on the game side (shared texture ring, HUD ring, pose publishing, VrGetEyeInfo); VrThread starts OpenXrLoop instead of the OpenVR loop when Api=openxr. Nothing outside vr_runtime.cpp knows which API is in use (StereoRenderPose, VrGetPose, VrGetEyeInfo give the same things; the pose is in the seated space either way).

  • Session (openxr_runtime.cpp): the 32-bit openxr_loader.dll from the mod folder (no import library), instance with XR_KHR_D3D11_enable, a D3D11 device on the runtime's adapter (LUID from xrGetD3D11GraphicsRequirementsKHR), a LOCAL (seated) and a VIEW reference space. XrRuntimeInit returns 1 / 0 / -1 (running / try again in 5 s / never): "no headset yet", an instance that cannot be created yet and a session that does not become ready are retries (up to the same 10 minutes as OpenVR); a missing loader, runtime or extension is final. [VR] OpenXRRuntime sets XR_RUNTIME_JSON before the loader looks. The field of view and the eye-to-head transforms are read once (the stereo code builds its matrices from them, like it does from GetProjectionRaw / GetEyeToHeadTransform); down is stored positive like the OpenVR path does.
  • Frames: xrWaitFrame is the pacing (as WaitGetPoses is), the head is xrLocateSpace(VIEW in LOCAL) at the predicted display time. The frame is ended by XrRuntimeEndFrame with up to two layers: the stereo scene is a projection layer whose eye poses are renderPose * eyeToHead - the pose the picture was rendered from, so the runtime reprojects the 60 fps picture like TextureWithPose - and the virtual screen / the HUD panel are quad layers (the HUD with premultiplied alpha, BLEND_TEXTURE_SOURCE_ALPHA; head-locked ones in the VIEW space). A frame with nothing to show is ended with no layers (SteamVR keeps a new session SYNCHRONIZED with shouldRender false until a frame has layers, so SYNCHRONIZED counts as render).
  • Pictures: the shared textures of the game's D3D9Ex device are opened on the runtime's device as before; every OpenXR layer needs its picture in a swapchain image, so the compositor thread does one CopyResource per new picture (swapchain format B8G8R8A8_UNORM_SRGB, which decodes like OpenVR's ColorSpace_Gamma; _UNORM as the fallback). Two swapchains, one per channel (picture, HUD). A layer is submitted again without a copy while the game has not drawn anything new (latestSeq / hudSeq): a swapchain layer shows its last released image, so a 60 fps game on a 90 Hz headset copies 60 times a second. The sequence number is only remembered once the layer was made (XrRuntimeEndFrame returns the channels), so a frame the runtime did not want rendered cannot leave a stale picture on the screen.
  • Recentring: OpenXR has no ResetZeroPose. F9 sets g.ref (the head's position and yaw, like SteamVR's seated zero pose); the published head pose is ref^-1 * pose, the layers get ref * pose back. A recentre in the runtime (XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING for LOCAL) resets ref to the identity, since LOCAL moved. A picture rendered just before an F9 is shown against the new reference for a frame or two. The virtual screen is placed on a head pose like the overlay was (FacingPanelPose) and kept as a pose in the game's space; the HUD panel is (0, HudHeight, -HudDistance).
  • Not done / different: HudCurve (the core spec has no curved quads), the dark scene layer behind the screen (OpenXR is black behind quads), and SteamVR's overlay features for the two panels.
  • Host check (tools/openxr_check.py, ported from BlurVR's): builds openxr_check.cpp, a stand-in game that links openxr_runtime.cpp and drives it like OpenXrLoop (the retry rule of XrRuntimeInit, a projection layer + HUD quad + flat-screen quad, pictures re-submitted without a copy, empty frames). Without arguments it runs the cases that start no runtime (the 32-bit loader reaches a 32-bit runtime with XR_KHR_D3D11_enable; a bogus OpenXRRuntime json and a missing loader both end cleanly with the reason in the log); --system also starts the runtime (launches SteamVR) and runs the frames.
  • Verified: builds (Zig), check_ini_defaults.py reads Api / OpenXRRuntime, the three no-runtime cases of openxr_check.py pass. Not yet run with a runtime or a headset (--system): the first headset test must read the OpenXR: / VR: lines of the log (instance, swapchain formats, first copy, VR: session up (OpenXR)), then check the scene's orientation, the HUD's alpha (the sRGB decode of premultiplied colour may thin the text edges a little), F9, and the screen at the intro.

FPS gauge (version 1.2, [VR] FpsCounter, F8)

fps_counter.cpp, ported from BlurVR's (same counting, graph and 5x7 font). StereoOnPresent calls FpsCounterFrame() every Present (counts, polls FpsKey, a figure every half second and a graph sample every quarter second; a gap of 2 s restarts the count) and FpsCounterDraw() after ApplyLetterbox in stereo frames: the panel is a set of coloured rectangles (DrawPrimitiveUP, state saved with a state block and only the original entry points used, like DrawFadeQuad) drawn straight into both eyes of the side-by-side back buffer, so it is in the picture the headset gets (OpenVR or OpenXR) and not in the HUD panel. It is locked to the head: a point in head space (1.5 m ahead, centre at tangents -0.34 / -0.30, 0.005 per font pixel) goes into each eye through VrGetEyeInfo's tangents and eyeToHead (inverse), so each eye sees it from its own place. Colours are measured against the game's own target (60 with Use60Fps, else 30), not the headset's refresh rate: the game runs at 60 on a 90 Hz headset on purpose, so BlurVR's refresh-rate colours would show red. Not drawn on the virtual screen (flat pictures). Not yet seen in the headset.

7z. Upscale (version 1.2, [VR] Upscale, UpscaleFactor, UpscaleSharpness)

BlurVR's upscaler (its NOTES section 32), ported as it is: src/upscale_d3d11.cpp, AMD FidelityFX Super Resolution 1.0 (EASU, edge-adaptive upsampling over a 12-tap neighbourhood, then RCAS, robust contrast adaptive sharpening; MIT, LICENSE_fsr.txt), one eye at a time so that nothing crosses the seam. The first version of this section was a Catmull-Rom + CAS pass of my own with an automatic size; it was dropped for this one (the user asked for BlurVR's upscaler and an explicit factor, no automatic mode).

  • On the compositor thread's Direct3D 11 device (the one the shared textures are opened on; the game's device is not touched). UpscaledPicture in vr_runtime.cpp is called where the stereo picture is picked up: VrThread (the texture handed to Submit, followed by a Flush) and OpenXrLoop (the texture copied into the swapchain, which flushes itself; the layer's size follows the texture). The same frame again returns the same texture (the loops run at the headset's rate, the game at its own). Stereo scenes only: the flat virtual screen and the HUD panel are left alone. One output texture and one middle texture of the output's size (B8G8R8A8), made on the first frame; if anything fails (no d3dcompiler_47.dll, texture creation) the log says so and the game's picture goes on as it is.
  • Size: UpscaleOutputSize: UpscaleFactor (1 to 4, default 1.5) times the game's picture, the width even. UpscaleSharpness 0 to 1 (default 0.75; 0 = no RCAS). At 3840x2160 and 1.5 that is 5760x3240, about 75 MB per texture: watch free VA in the stats: lines in a race (a 32-bit game).
  • Why the effect is small at 3840x2160 (the user saw little with the first version too): the Index panel is 1440x1600 per eye and the game's picture 1920x2160 per eye, so the compositor already shrinks it; an upscale in between mostly changes how it is filtered. It pays when the game renders less than the panel's size (the 2880x1620 entry).
  • Host check tools/upscale_check.py (BlurVR's, on WARP): the shaders compile, gradient, seam, step edge, flat picture, same size.

7aa. The window on the desktop (version 1.2, [VR] DesktopView = off | left | right | both, default off)

Ported from BlurVR (its NOTES section 20): the game's picture goes to the headset, the window is only a mirror - but it is what the keyboard and gamepad belong to, so it has to exist.

  • The game is windowed now. The Steam build asks for exclusive full screen at the saved 3840x2160 (CreateDevice request: ... windowed 0; the monitor has that mode). DesktopViewAdjustParams (called from AdjustPresentParams, i.e. CreateDevice and every Reset) turns a request of a headset session (Stereo=1, shared transport) into Windowed=TRUE, swap effect COPY, one back buffer (Present only takes a source rectangle with COPY; not done when the game asks for multisampling). H_CreateDevice now tells window_spoof windowed / the intended size after that adjustment.
  • The window's shape (KeepWindow, every Present): with the headset running and off, a small captioned window (1280x720 client, 3/4 of the work area on a small monitor, centred the first time, the user may move it); with left / right / both a WS_POPUP over the whole monitor. Before the headset runs (no SteamVR yet, headset off) the window is the borderless one too, so the flat game fits the screen (the game's own 3840x2160 popup would be bigger than a scaled monitor). WM_WINDOWPOSCHANGING of that window is constrained to the same rectangle (DesktopViewConstrain in GameProcHook), so the game's own SetWindowPos after a Reset does not undo it. window_spoof.cpp keeps several wrapped windows now (WindowSpoofAdopt wraps the device's focus window; the lie about the client size - the size the game asked for - is also on whenever DesktopViewManaged()), so a small window does not make the game Reset to its size.
  • off (desktop_message.cpp, BlurVR's, nearly verbatim): a picture the size of the window made with GDI once per size (dark gradient, the game's icon - the first RT_GROUP_ICON of SplitSecond.exe, an 'S', 32x32 enlarged - "Playing in VR" and a hint line), UpdateSurfaced into a default-pool surface and StretchRected into the back buffer's top-left corner, which is Present's source rectangle; the game's Present is skipped except every 500 ms and on a size change.
  • left / right / both (PaintEyes): this frame's copy for the headset (VrDesktopSource: sharedSurface[slot], set in VrOnPresent) is StretchRected (linear) into the corner at the window's own size: left / right the largest piece around the straight-ahead point that has the monitor's shape, from the eye's tangents (BlurVR's crop), both the whole side-by-side picture fitted into the window with black bars. The picture has no HUD panel (it is separate) and carries the game's cinematic bars. Flat frames (menus, loading: the headset's virtual screen) are presented whole. If the driver refuses the rectangle (Present with a source rectangle failed) the whole back buffer is presented.
  • Checked (this PC, 4K monitor at 200 % scaling, so the process sees 1920x1080): tools/desktop_message_check.py (layout, device corner pixel for pixel on a 9 and a 9Ex device, rectangles, release); the game itself with Headless=1: off = a 1286x749 window with the message (grabbed with PrintWindow), left = a borderless 1920x1080 window with the left eye's view of the menu scene (cinematic bars in it), both = both eyes with black bars; and a run on the real headset session (SteamVR started by the game): borderless flat window until "session up", then the message window, Upscale and the stereo scene running with no Submit error, free VA 610 MB. Not yet checked: right (same code as left with the other eye), what the monitor shows in a race on the 90 Hz headset (frame time with the window in each mode), a monitor of another shape (the crop and the bars are computed from the window's real size).
  • Input focus (found 2026-11-07, the first headset race with DesktopView: "the car accelerates by itself, the pad does nothing, the camera looks back"): the game reads its game controller through DirectInput with the cooperative level EXCLUSIVE | FOREGROUND (0x5, log line DirectInput: SetCooperativeLevel(0x5); XInput is only imported for rumble) and asks GetForegroundWindow itself. In exclusive full screen its window was always the foreground one; the window of a headset session is not when the player has the headset on (SteamVR, the desktop), so the pad is not acquired, its axes read zero (the end of their range: full throttle, the look-back direction). window_spoof.cpp now hooks GetForegroundWindow (the game is told its window is the foreground one while the headset runs: DesktopViewInputWindow), the exe's DirectInput8Create -> IDirectInput8::CreateDevice -> IDirectInputDevice8::SetCooperativeLevel of every device that is not GUID_SysKeyboard / GUID_SysMouse: NONEXCLUSIVE | BACKGROUND (0xA). The keyboard stays a foreground reader (the message window says "click this window"). Checked: the hooks engage in a headset session (log lines above); a real pad was not at hand, so whether the pad answers unfocused is up to the next headset race.
  • Focus loss and the pointer (same day, from the user's next tests): clicking off the window (or SteamVR starting) deactivated it (WM_NCACTIVATE / WM_ACTIVATE / WM_ACTIVATEAPP false / WM_KILLFOCUS in the log) and the game answered by minimising itself, after which it was deaf and did not come back. While the headset runs GameProcHook now turns those into "active" (WM_KILLFOCUS is swallowed) and KeepWindow restores a window that is minimised without a WM_SYSCOMMAND SC_MINIMIZE (the minimise button still works). And the mouse pointer was pinned to the lower right corner: the game calls SetCursorPos to the middle of what it thinks its window is (3840x2160, the spoofed size), which is off the screen of a 1920x1080 monitor; SetCursorPos is a no-op for it while the headset runs (reproduced: the pointer sat at 1919,1079 whatever a script set; with the hook it moves freely). Checked by clicking the desktop in a headset session: no minimise, no restore needed.
  • The ini's resolution (added later, "the ini resolution settings are not honoured"): the game takes its video mode from config_ss.cfg, so [Render] CustomWidth / CustomHeight only added a list entry and the saved mode won. The two keys are now one, [Render] Resolution=3840x2160 (CustomWidth / CustomHeight are no longer read). When it is written in the ini (g_cfg.customExplicit), ApplyIniResolution (window_spoof.cpp, run at the first InstallWindowSizeSpoof, before the game opens the file ~10 s later) writes the size into the two dwords ReadSavedVideoSize finds, after copying the file once to config_ss.cfg.splitsecondvr.bak. Checked: 2560x1440 in the ini on a 3840x2160 save -> CreateDevice, main render size, HUD textures and the upscale input all 2560x1440. Starting the exe directly makes Steam relaunch it, so the log of such a run shows the second process (the first did the patch).
  • Side effect: build.bat links -lgdi32 now (the message's GDI calls).

8. What is left

  • Phase 2 leftovers: light shafts (shaders exist, never seen in a capture) are not handled; the cascaded shadow maps and the 512x512 reflection pass of races are not per eye. Done: bloom (local blurs + shared exposure: fine as it is), vignette and lens flare (7k).
  • TODO (later, optional): per-eye camera motion blur. The game's blur pass (MB_matMotion360, PS ff186290, reads the tone-mapped picture + depth and reprojects with the game camera's motion matrices; the older ScrVelBlur / SimpleMotionBlur / MotionBlurNoisePass shaders are the same idea) is replaced by a plain copy in stereo now (MotionBlurPassThrough, [VR] MotionBlur=0; it was the most uncomfortable thing in races). Bringing it back as an option means running that pass once per eye (scissor halves) with each eye's depth rays / motion matrices (compare RunQuadRays), probably with a reduced strength; then MotionBlur=2 = per eye.
  • Phase 4: black fades / letterbox bars are head-locked now (7l; other cinematics' bars unchecked); rolled cinematic cameras (comfort); loading-screen detection (flat screen vs stereo) is by draw counts only; HUD panel size per scene (tied to the game's FOV, optional).
  • Phase 5: head-aware culling is done by widening (7m); shadow quality at the wide frustum and the reflection pass's culling are open.
  • Phase 6: address-space headroom at higher resolution, 4K, performance numbers per scene.
  • Open question: why the exact 4th view row (0 0 0 1) makes smoke / mist vanish while (r3 - r2) / delta does not (7f); a clean answer would remove LegacyRemap.
  • Also open: the card names in the carousel are view dependent when the head moves sideways with MenuHeadMove=1.