Fixed Foveated Rendering for SteamVR games
This modified openvr_api.dll will enable Fixed Foveated Rendering (FFR) in D3D11-based SteamVR games.
The idea behind "fixed foveated" rendering is to save some GPU performance by rendering the outer areas of the VR images at a lower resolution while still rendering the center of the image at full resolution. Due to current HMD optics, the edges of the image are blurry, anyway, so rendering those parts at a lower resolution can save performance without impacting the visual fidelity too badly.
This mod divides the image into 4 rings, with each ring's radius being configurable. The inner-most ring (image center) is rendered at full resolution, the second ring at half resolution, the third ring at a quarter of the original resolution, and the remainder of the image is rendered at 1/16th of the original resolution.
Optionally, a sharpening filter can be applied to the final image. While this doesn't strictly have anything to do with FFR, most VR games benefit from a bit of sharpening.
This mod injects itself into the rendering process of the game. Unfortunately, not all games will work well with the chosen approach and may either break completely or display only the inner-most ring of the image properly. In some cases, disabling certain graphics settings may be required to get FFR working. In other instances, the game may simply be incompatible.
Please refer to the Wiki for information about particular games that have been tested by myself or others. Feel free to add your own test results.
Currently two methods are implemented to achieve fixed foveated rendering:
You can select your preferred technique in the config file, by either enabling or
disabling useVariableRateShading
. Note: if VRS is not available, the mod will
fall back to Radial Density Masking.
First, download the openvr_foveated.zip
file from the latest release under "Assets".
Then find the location of the openvr_api.dll in the game's installation folder:
<GameDir>\<Game>_Data\Plugins
<GameDir>\Engine\Binaries\ThirdParty\OpenVR\OpenVRvX_Y_Z
Rename the existing openvr_api.dll
to openvr_api.orig.dll
, then extract both
the openvr_api.dll
and the openvr_mod.cfg
from the archive to this directory.
You can now edit the openvr_mod.cfg
to your liking or just use the defaults.
In case you want to uninstall the mod, simply remove the openvr_api.dll
file again
and rename the original openvr_api.orig.dll
back to openvr_api.dll
.
In case you run into issues, the log file (openvr_mod.log
) may provide clues to
what's going on.
The mod is configured by editing the values in its config file, openvr_mod.cfg
. The
parameters innerRadius
, midRadius
and outerRadius
determine the size of the four
rings as described above. The smaller the values for the radii, the fewer pixels are rendered,
but visual fidelity will suffer. Experiment at will.
Hotkeys are available to modify certain configuration settings on the fly. The hotkeys can be configured in the config file; they can also be globally disabled to prevent interference with game hotkeys. Note that any config changes done in-game via hotkeys will not be persisted and reset back to the values in the config file on the next game launch.
To build the project, you need CMake and Visual Studio. You also need to download the NVAPI SDK (requires NVIDIA developer account) and copy the nvapi64.lib to src/nvapi.
Use CMake to generate project files for Visual Studio. Make sure to enable
BUILD_SHARED
in the CMake options.