reshade Documentation

A generic post-processing injector for games and video software.

5,172 stars C++ C++ 1 file ยท ~2,321 tokens #compiler#d3d11#d3d12#d3d9#glsl#hlsl#hook#injector
RAW Doc

File: README.md

ReShade

This is a generic post-processing injector for games and video software. It exposes an automated way to access both frame color and depth information and a custom shader language called ReShade FX to write effects like ambient occlusion, depth of field, color correction and more which work everywhere.

ReShade can optionally load add-ons, DLLs that make use of the ReShade API to extend functionality of both ReShade and/or the application ReShade is being applied to. To get started on how to write your own add-on, check out the API reference.

The ReShade FX shader compiler contained in this repository is standalone, so can be integrated into other projects as well. Simply add all source/effect_*.* files to your project and use it similar to the fxc example.

Building

You'll need Visual Studio 2017 or higher to build ReShade. And Python in the PATH environment variable for the glad dependency to build.

  1. Clone this repository including all Git submodules\

git clone --recurse-submodules https://github.com/crosire/reshade
2. Open the Visual Studio solution
3. Select either the 32-bit or 64-bit target platform and build the solution.
This will build ReShade and all dependencies. To build the setup tool, first build the Release configuration for both 32-bit and 64-bit targets and only afterwards build the Release Setup configuration (does not matter which target is selected then).

A quick overview of what some of the source code files contain:

File Description
dll_log.cpp Simple file logger implementation
dll_main.cpp Main entry point (and optional test application)
dll_resources.cpp Access to DLL resource data (e.g. built-in shaders)
effect_lexer.cpp Lexical analyzer for C-like languages
effect_parser_stmt.cpp Parser for the ReShade FX shader language
effect_preprocessor.cpp C-like preprocessor implementation
hook.cpp Wrapper around MinHook which tracks associated function pointers
hook_manager.cpp Automatic hook installation based on DLL exports
input.cpp Keyboard and mouse input management
runtime.cpp Core ReShade runtime including effect and preset management
runtime_gui.cpp Overlay rendering and everything user interface related

Contributing

Any contributions to the project are welcomed, it's recommended to use GitHub pull requests.

Feedback and Support

See the ReShade Forum and Discord server for feedback and support.

License

ReShade is licensed under the terms of the BSD 3-clause license.
Some source code files are dual-licensed and are also available under the terms of the MIT license, when stated as such at the top of those files.


File: examples/README.md

ReShade API Examples

Detailed API documentation can be found at https://crosire.github.io/reshade-docs/index.html.

[01-fps_limit](/examples/01-fps_limit)

Limits the frame rate of an application to a specified FPS value.

[02-freepie](/examples/02-freepie)

Adds support for reading FreePIE input data in effects via uniform variables.

[03-history_window](/examples/03-history_window)

Adds an overlay that keeps track of changes to techniques and uniform variables and allows reverting and redoing them.

[04-api_trace](/examples/04-api_trace)

Logs the graphics API calls done by the application of the next frame after pressing a keyboard shortcut. This can be a useful to help understanding what an application is doing during a frame.

[05-shader_dump](/examples/05-shader_dump)

Dumps all shader binaries used by the application to disk (into 0x[CRC-32 hash].cso/spv/glsl files).

[06-shader_replace](/examples/06-shader_replace)

Replaces shader binaries before they are used by the application with binaries from disk (looks for a matching 0x[CRC-32 hash].cso/spv/glsl file and will then load it and overwrite the data from the application before shader creation).
One can use the shader_dump add-on to dump all shaders, then modify some and use shader_replace to inject those modifications back into the application.

[07-texture_dump](/examples/07-texture_dump)

Dumps all textures used by the application to image files on disk (into 0x[CRC-32 hash].png files).

[08-texture_replace](/examples/08-texture_replace)

Replaces textures before they are used by the application with image files from disk (looks for a matching 0x[CRC-32 hash].png file and will then load it annd overwrite the image data from the application before texture creation).
One can use the texture_dump add-on to dump all textures, then modify some and use texture_replace to inject those modifications back into the application.

[09-depth](/examples/09-depth)

Built-in add-on that attempts to find the depth buffer the application uses for scene rendering and makes it available to ReShade effects.

[10-texture_overlay](/examples/10-texture_overlay)

Adds an overlay to inspect textures used by the application in-game and allows dumping individual ones to disk. This allows for more control over which textures to dump, in constrast to the texture_dump add-on, which simply dumps them all.

This example makes use of a standalone utility (see descriptor_tracking.cpp and descriptor_tracking.hpp) that tracks the contents of all descriptor sets, making it possible to query information about which resources those contain at any time.

[11-obs_capture](/examples/11-obs_capture)

An OBS capture driver which overrides the one OBS ships with to be able to give more control over where in the frame to send images to OBS.

[12-video_capture](/examples/12-video_capture)

Captures the screen after effects were rendered and uses FFmpeg to create a video file from that. Currently does a device to host copy before encoding, so is rather slow.
To build this example, first place a built version of the FFmpeg SDK into a subdirectory called ffmpeg inside the add-on project directory and don't forget to copy the FFmpeg binaries to the location this add-on is to be used as well.

[13-effects_during_frame](/examples/13-effects_during_frame)

Renders the ReShade post-processing effects at a different point during the frame, e.g. to apply them before the user interface of the game.

This example makes use of a standalone utility (see state_tracking.cpp and state_tracking.hpp) that tracks all render state currently bound on a command list, making it possible to query information about it at any time, e.g. to re-apply state after it was modified by a call to reshade::api::effect_runtime::render_effects().

[14-ray_tracing](/examples/14-ray_tracing)

Shows how to use the ReShade API to create acceleration structures and trace rays using DXR or Vulkan Ray Tracing. The example traces rays against a single triangle and blits the resulting image to the back buffer.

[15-effect_runtime_sync](/examples/15-effect_runtime_sync)

Built-in add-on that adds preset synchronization between different effect runtime instances, e.g. to have changes in a desktop window reflect in VR.

[16-swapchain_override](/examples/16-swapchain_override)

Adds options to ReShade.ini to force the application into windowed or fullscreen mode, or a specific resolution or the default refresh rate.

text
[APP]
ForceVsync=0
ForceWindowed=0
ForceFullscreen=0
Force10BitFormat=0
ForceDefaultRefreshRate=0
ForceResolution=0,0

[17-screenshot_to_clipboard](/examples/17-screenshot_to_clipboard)

Copies the saved image file to the Windows clipboard every time a screenshot is taken.

[18-window_transparency](/examples/18-window_transparency)

Disables transparency for windows, since it messes with effects that do not return an alpha value.