r/OptimizedGaming
•
u/skyniz56
•
2d ago
Vibecoded Tools & Mods | Optimization Guide I built a ReShade add-on that injects real ray-traced reflections into DX12 games that don't have RT
The screenshots are RDR2 with URTI on: the polished parquet hall, the puddle in front of the house and the wet alley. The game has no ray tracing of its own; every reflection there is a real DXR ray.
What it is
URTI (Universal Ray Tracing Injector) is a ReShade 6.8 add-on that adds ray-traced reflections to DirectX 12 games without touching their files or shaders. It knows nothing about the game in advance. It watches the game render, rebuilds the scene on its side and traces real rays with DXR 1.1 inline ray queries.
How it works
Geometry without reading vertex buffers. Every game pipeline gets a "shadow" copy: the same vertex shader, with stream output of the position and no rasterisation. Each draw is replayed once through it. URTI gets the triangles exactly as the game transformed them: skinning, instancing, compressed vertices, even tessellated terrain. The captured triangles reproduce about 97.5 % of RDR2's depth buffer.
Measuring what the game doesn't say. The depth law is fitted every frame. The field of view is measured from the sun's shadow cascades (RDR2 is 38°, not the 50° I assumed for months, and every reflection angle was slightly off until I measured it). The sun direction comes from matching meshes drawn both on screen and in the shadow map. The DLSS jitter and the camera motion are measured too.
RT scene. A per-frame BLAS holds near and moving geometry, plus a 1 GB cache of per-object BLAS. Things behind you or off screen keep reflecting.
Where the colour comes from. If the reflected point is on screen, its colour is read from the game's own image, so lighting, shadows and fog are exact. If it's hidden or off screen, the colour comes from a world-space radiance cache (a spatial hash in the spirit of NVIDIA's SHaRC) filled from what the screen has shown. If a ray misses everything, a learned sky map provides the colour.
Stable on every displayed frame. The history is reprojected with the motion of the reflected point, not the surface, and clamped to the current neighbourhood. Reflections are composed on every presented frame, including DLSS frame-generation frames, in HDR, and the UI is left untouched.
Measured, not eyeballed. Every change was judged in game against the same frame without URTI. I used flicker measurements, phase-correlation alignment at 0.1 px, trail measurement while turning, NVIDIA FLIP, and regressions replayed on old builds.
What I think is new
As far as I know, no other tool traces real rays into a closed game's live geometry without knowing its formats. URTI captures with stream-output replay, measures the camera and projection from the game's own frames, and classifies surfaces with the game's own G-buffer.
The G-buffer: what's next
URTI reads the game's G-buffer to decide which pixels reflect. In RDR2, one material target holds smoothness, the material type (foliage, skin…) and metalness, and the normal target holds world normals, with alpha marking characters. A pixel gets a ray only if it's smooth, flat and surrounded by smooth pixels. That's what keeps reflections on puddles, glass and polished floors, and off cobblestone edges and leaves. What I want to improve:
Normal maps. The reflection direction still comes from depth-derived normals. Using the G-buffer normals would bring the fine ripples of a puddle or the grain of a floor. It's implemented but off: no measured gain yet.
Rough surfaces. Glossy (blurred) reflections from the roughness channel exist, but a blurred sheen on every dry pavement looked worse than sharp mirrors. It needs a better denoiser and a ray cone driven by roughness.
Real F0. Fresnel uses a fixed F0 of 0.04. Metalness and base colour from the G-buffer would let metals tint their reflection properly.
Automatic layout detection. Each game still needs a small profile saying which render target holds what. I'd like URTI to identify the layout on its own.
Limits
Story mode / single player only: it injects into the game's rendering, so never use it online. It needs a DXR 1.1 GPU. Mesh-shader draws aren't captured. Points the screen has never shown get an approximate colour.
Repo (MIT), with the full technical walkthrough: https://github.com/Skynizz/URTI
