OpenXR API layer that applies AMD FidelityFX CAS (Contrast Adaptive Sharpening) to any D3D11 OpenXR app at xrEndFrame, with an optional Levels post-process (black/white/gamma).
This is a post-processing layer for OpenXR VR applications that enhances image quality by applying sharpening and optional color adjustments. It works with any OpenXR application using Direct3D 11 rendering, making VR content appear sharper and more detailed without modifying the original application.
- Platform: Windows 10/11, x64
- Graphics: Direct3D 11 only
- Status: Production-ready, minimal overhead
- Compatible with: Any OpenXR runtime (SteamVR, Oculus, Windows Mixed Reality, etc.)
- CAS sharpening with strength >= 0 (values > 1 run multiple passes)
- Optional Levels adjustment (in/out black/white and gamma)
- Minimal overhead, no per-frame allocations (texture pooling)
- Robust format handling (UNORM/SRGB/TYPELESS, R16G16B16A16_FLOAT)
- Download the latest release from the Releases page
- Extract the ZIP file to a folder of your choice
- Right-click
Install-Layer.ps1and select "Run with PowerShell" (requires admin rights)- This registers the layer system-wide for all OpenXR applications
- Launch any OpenXR VR application - the sharpening will be applied automatically
- Prerequisites:
- Visual Studio 2019 or 2022 with C++ development tools
- Windows SDK
- Git (to clone the repository)
- Clone the repository:
git clone https://github.com/elliotttate/OpenXR-CAS.git cd OpenXR-CAS - Build using Visual Studio or command line:
& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" .\XR_APILAYER_OPENXR_SHARPENER.sln /t:Build /p:Configuration=Release /p:Platform=x64
- The built files will be in
bin\x64\Release - Run
Install-Layer.ps1from the output directory to install
To remove the layer, run Uninstall-Layer.ps1 from the installation folder with admin rights.
The layer automatically creates a configuration file at:
%LOCALAPPDATA%\XR_APILAYER_OPENXR_SHARPENER\config.cfg
You can edit this file with any text editor (e.g., Notepad) to customize the sharpening and color adjustment settings.
Sharpening Settings:
# Sharpness strength (0.0 = off, 0.6 = default, 1.0 = maximum single pass)
# Values > 1.0 apply multiple sharpening passes for extreme sharpening
sharpness=0.6Color Adjustment Settings (Levels):
# Enable/disable color levels adjustment
levels_enable=0 # 0 = disabled, 1 = enabled
# Input black and white points (values from 0.0 to 1.0)
# Adjusts which input values map to black and white
levels_in_black=0.0 # Values below this become black
levels_in_white=1.0 # Values above this become white
# Output black and white points (values from 0.0 to 1.0)
# Remaps the output range
levels_out_black=0.0 # Black level in output
levels_out_white=1.0 # White level in output
# Gamma correction (> 0.001)
# 1.0 = no change, < 1.0 = darker, > 1.0 = brighter
levels_gamma=1.0For general VR gaming:
sharpness=0.6
levels_enable=0For slightly washed-out content:
sharpness=0.7
levels_enable=1
levels_in_black=0.05
levels_in_white=0.95
levels_gamma=1.1For maximum sharpness (may introduce artifacts):
sharpness=1.5
levels_enable=0The configuration is read in this priority order:
- Environment variables (e.g.,
XR_CAS_SHARPNESS=0.8) - User config:
%LOCALAPPDATA%\XR_APILAYER_OPENXR_SHARPENER\config.cfg - Installation folder config:
config.cfgin the DLL directory
Once installed, the layer works automatically with any OpenXR application:
- No application modification needed - The layer intercepts OpenXR calls transparently
- Works with all OpenXR runtimes - Compatible with SteamVR, Oculus, WMR, Varjo, etc.
- Real-time adjustments - Edit the config file while your VR app is running; changes apply on next frame
- Per-application settings - You can create different configs and swap them for different games
- Start with default settings (
sharpness=0.6) - Launch your VR application
- If the image looks over-sharpened, reduce to
0.4or0.5 - If you want more sharpness, try
0.8or0.9 - Values above
1.0apply multiple passes - use carefully as this can introduce artifacts
- Minimal overhead: Typically < 0.5ms per frame on modern GPUs
- No CPU overhead: All processing happens on GPU
- Memory efficient: Uses texture pooling to avoid allocations
Layer not loading:
- Ensure the manifest is registered (run
Install-Layer.ps1as admin) - Verify both the app and runtime are 64-bit
- Check Windows Event Viewer for OpenXR errors
- Try reinstalling with admin privileges
Black or corrupted output:
- The layer requires specific swapchain formats:
- Supported: R8G8B8A8/B8G8R8A8 (UNORM/SRGB/TYPELESS), R16G16B16A16_FLOAT
- Not supported: MSAA swapchains, compressed formats
- Try disabling other OpenXR layers that might conflict
Performance issues:
- Reduce sharpness value (lower values = less processing)
- Disable levels adjustment if not needed (
levels_enable=0) - Update GPU drivers to latest version
Application crashes with high sharpness:
- Values above 1.0 use multiple passes and may cause issues
- Start with
sharpness=0.6and increase gradually - Some older GPUs may not handle extreme values well
To check if the layer is properly installed:
- Open PowerShell as admin
- Run:
reg query "HKLM\SOFTWARE\Khronos\OpenXR\1\ApiLayers\Implicit" - You should see an entry for
XR_APILAYER_OPENXR_SHARPENER
If you encounter issues:
- Check the Issues page for known problems
- Ensure you're using the latest release
- Try with a simple OpenXR application first to isolate the problem
- Code: MIT (see LICENSE)
- AMD FidelityFX CAS headers (
ffx_a.h,ffx_cas.h) are © AMD; see their respective licenses.
Based on the OpenXR Layer Template by Matthieu Bucchianeri with extensive modifications for CAS/Levels and D3D11 pipeline integration.