File information

Last updated

Original upload

Created by

linehand

Uploaded by

linehand

Virus scan

Safe to use

Tags for this mod

Documentation

Readme

View as plain text



# Screen Space Shadows and Reflections Fix v2.0

> This ReadMe file is basically identical to the mod description on [Nexus Mods](https://www.nexusmods.com/reddeadredemption2/mods/4627)

Simple ReShade over-render and crop workaround fix. Scales up rendered image beyond display borders, **eliminating most of the worst screen space effect artifacts around viewport edges**. Only two effects, (V1.0 is single effect) so _absolutely minimal performance impact_. **Zero change to vanilla style/aesthetics** beyond artifact elimination.


### **V2.0 mod update is a massive improvement. See details below, and check out the new video showcasing V2.0 in-game.**

**Any Issues, or for Assistance With Installation and Setup, Just Request Assistance in the Posts Tab Above, and I'll Reply ASAP**


# **TL:DR**

The abrupt termination of screen space shadows & reflections around screen edges, due to their origins (the elements that those respective shadows/reflections originate from) falling outside of screen space, is poorly handled in RDR2, and generally looks pretty bad.

This ReShade preset addresses this issue by simply scaling the rendered image up slightly to push those artifacts off screen, and thereby eliminating most of these screen space artifacts. Essentially this is a standard _over-render and crop_ implementation.

V2.0 operates entirely beneath the UI, and thus is able to scale and crop substantially more of the rendered image (without effecting the UI) and thus effectively eliminate almost all of the horizontal screen space artifacts along screen edges (which are the most jarringly obvious ones).

V2.0 operating beneath the UI, means that virtually all other mods should now be 100% compatible, even if they add UI elements.

V2.0 includes a single sharpen effect in order to effectively compensate for the minor blur incurred by upscaling the image, in addition to the single DisplayMod effect used to upscale the image. I chose the METEOR NVsharpen effect for it's combination of high performance with no visible artifacts, and because it's image quality closely matches the pre-upscaled image quality. The result, is that while upscaling the image does slightly impact image quality, the subtle sharpening fully corrects for that, resulting in a final image that is just very slightly sharper than the vanilla image.

V2.0 is **only compatible with DX12**. I wish I could make it work in Vulkan, but the REST addon for ReShade is unable to inject effects beneath the UI in RDR2's Vulkan at this time. _Any graphics programmers feel like digging into the REST addon's source code, to help get this working for Vulkan?_

V1.0 will remain available and **V1.0 can be used with Vulkan**, but without the UI support for the [Walk Speed Control and Auto-Walk](https://www.nexusmods.com/reddeadredemption2/mods/1491) mod by [Taki7o7](https://www.nexusmods.com/reddeadredemption2/users/147357503) (replaced with full game UI support in V2.0). However_,_ _I highly recommend DX12 (with V2.0 of this mod) over Vulkan at this point_.


## **Installation**


Very detailed instructions, even though it's actually really simple (well V1.0 was really simple, version 2.0 requires a bit more setup, but it's worth it). If you already have ReShade (with addon support) installed for RDR2, you can just grab the latest release of this addon [ReShadeEffectShaderToggler](https://github.com/4lex4nder/ReshadeEffectShaderToggler/releases/tag/v1.3.20) (the .addon64 file goes in base game dir, and the .fx files go into Red Dead Redemption 2\reshade-shaders\Shaders\REST). Then extract this mod's files to base game directory. Be sure to set a toggle hotkey in ReShade to enable/disable effects, because you'll probably need to toggle this fix off occasionally (V2.0 should almost never need to be toggled off, but it's still recommended to have the hotkey setup as an option).


**Important Notes Regarding V2.0:**

- If you had previously set "UI safe zones" to 90% in the in-game display settings, as required for V1.0, you can set them back to 100% (or whatever you prefer) as V2.0 no longer requires any specific UI safe zones setup.
- V2.0 should work entirely beneath the game's UI (except for the full size map).
- The only issue with the game's UI in V2.0 is when opening the full size map, which doesn't work with this preset active - so I have included AutoHotkey scripts (for both AutoHotkey V1.1+ and AutoHotkey V2+) which can be used to automatically disable this mod's effects when opening the full size map, and re-enable this mod's effects when closing the full size map. See additional AHK info below.
- V2.0 is DX12 only for the time being. For Vulkan, use V1.0.


**Important Notes Regarding V1.0:**

- Be sure to go into the in-game display settings and set "UI safe zones" to 90% horizontal and vertical (unnecessary with V2.0).


### **Step by Step Install Instructions:**

These instructions are for _both mod version 1.0 and 2.0._ Steps that start with "**For mod version 1.0**" _or_ "**For mod version 2.0**" apply to that specific version only and should be _skipped_ if you are installing a different version.

1. Extract contents of this mod's zip file to RDR2 game directory

2. If you are using V1.0 with Vulkan, then delete the ReshadeEffectShaderToggler.ini file from the game directory (placed there in step 1 above)

3. Download latest version of [ReShade](https://reshade.me) (make sure to choose the version with addon support)

4. Install ReShade for RDR2.exe, and **_choose the Vulkan_** option (even if using V2.0 of this mod with DX12, because _installing ReShade for Vulkan will allow ReShade to work with both DX12 and Vulkan_, whereas installing ReShade for DX10/11/12 will only work with DX12 in RDR2 and won't work in Vulkan, so the Vulkan install option for ReShade is generally the preferred install option for RDR2)

5. During the _effect selection step_ of the ReShade install, **either** toggle _off_ then _on_ the 'select all effects' option in order to _install all ReShade effects_, **or** at the bottom, input the path to this mod's ReShadeRDR2fix.ini file that you should have dropped into the game directory, and opt to _only download effects required for that preset_.

6. During the addon selection step of ReShade install, be sure to at least choose the _ReShadeEffectShaderToggler_ by _4lex4nder_ (often referred to as **REST**)

7. **For mod version 2.0**, you'll also need to install [AutoHotkey](https://www.autohotkey.com/) (AHK), if you don't already have it installed. Download either v2.0 or v1.1 (I'd recommend v2.0 but I've included scripts for both versions, so either will work). Best to install AHK to default location or certain features of AHK may not work as expected.

8. **For mod version 2.0**, In the RDR2 base game directory, find the .ahk script file that matches your installed/preferred version of AutoHotkey. ReShade_RDR2fix_Map_AHKv11.ahk for AutoHotkey v1.1, or ReShade_RDR2fix_Map_AHKv2.ahk for AutoHotkey v2.0. Choose one of these two script files according to your AHK version, and create a shortcut to it next to the shortcut you normally use to launch RDR2

9. **For mod version 2.0**, Double click the shortcut you just created to launch the script, and you'll probably get a user account control prompt asking you to confirm, which is required for this too work (for security concerns see details regarding AHK scripts below).

10. After ReShade is installed (and AutoHotkey for version 2.0 of this mod), launch the game (on first run ReShade may take a moment to compile shaders), then on the opening title menu of RDR2, tap the _Home_ key in order to open the ReShade overlay, and either complete the tutorial, or skip it, then select the _settings_ tab in ReShade, and near the top, assign a hotkey for toggling effects (I recommend _PgUp_, or _End_)

11. **For mod version 2.0**, you should seldom need to disable all effects with that hotkey, but you may prefer using that hotkey to disable effects when browsing catalogs in-game (see compatibility info below).

12. **For mod version 1.0** you'll need to use that toggle effect hotkey at times, to temporarily disable all ReShade effects, like here, on the opening menu, the setting menus, the map screen, because the active regions for clicking options/waypoints won't line up perfectly with the scaled image (don't worry, the crosshair, or anything that is at the center of the screen will be perfectly aligned, and given that keyboard/controller UI navigation is unaffected, this is not really an issue in game for most activities)

13. Before leaving ReShade's settings tab, I'd reccomend turning on the option to _load only enabled effects_, for speed and performance. Then click on the _Home_ tab at the top of ReShade's UI, and on the Home tab at the top next to the two arrows < > it shows the currently loaded preset. If it doesn't say _ReShadeRDR2fix_ there, then use the arrows to switch to the _ReShadeRDR2fix_ preset.

14. **For mod version 2.0**, right click on _ReShadeRDR2fix_ and a box will appear to assign a hotkey, click in the box, and then press the [ key (square opening bracket), then use the arrows < > to switch to the _ReShadeRDR2fixOff_ preset, and right click on the preset name, to set a hotkey click in the box, and this time use the ] key (square closing bracket). Then use the arrows to switch back to the _ReShadeRDR2fix_ preset. _For mod version 2.0, you must assign these specific hotkeys in ReShade for these two presets respectively, in order for the AHK script to effectively disable effects when opening the map in game automatically._

15. Be sure _ReShadeRDR2fix_ is the active preset, and at the bottom right corner, enable _Performance Mode_, before closing the ReShade overlay with the _home_ key (if you ever want to edit individual effect settings, you'll need to disable _performance mode_)

16. **For mod version 1.0**, toggle the effects off with the hotkey you defined in step 10, before going into settings > display > safe zone and setting both horizontal and vertical safe zones to 90% (the minimum)

17. Start story mode

18. **For mod version 2.0**, once loaded into the game, tap your toggle effects hotkey at any time to disable this mod, tap again to enable it (the mod will be enabled automatically when starting the game). Just remember to always launch that .ahk script shortcut before starting the game for the first time (the script can be left running in the background between play sessions without issue as it only targets RDR2 windows and should have no performance impact, but you can find the AHK icon in your system tray and right click it to exit the script if you prefer, just remember to have it running when playing RDR2).

19. **For mod version 1.0**, once loaded into the game, tap your toggle effects hotkey to enable this mod, tap again to disable it. The mod will be enabled automatically when starting the game, but you may prefer to use the hotkey to disable it on that opening menu, and then enable it once loaded into story mode. In general the UI safe zones should account for the image scaling in game, but in the menus, when opening rampage trainer, and on the full size map, it may be best to either use keyboard/controller navigation, or disable effects.

20. Done (the effect will be enabled whenever you start the game now, disable as needed with your hotkey).


# **Compatibility**

### **Version 2.0 Compatibility Info**

- Should be compatible with almost everything, as the included ReshadeEffectShaderToggler.ini for the Reshade addon ReshadeEffectShaderToggler (REST) which allows ReShade to inject this mod's effects entirely beneath the game's UI.

- For Rampage Trainer, alignment/layout issues are fixed in V2.0 of this mod, and in Rampage Trainer's settings are options to adjust placement on screen.

- Browsing catalogs in game, and trying to click on catalog items with the mouse reveals alignment issues (because catalogs are 3D objects rather than UI elements), either use the hotkey to disable ReShade effects when browsing catalogs, or just use the arrow keys and enter button to select items in catalogs.

- The full size map gets annihilated by this mod. Either use one of the included AutoHotkey scripts to completely fix this issue, or disable ReShade effects with the hotkey before opening the full size map. If ReShade effects are enabled when the map is closed, the effects recompile, which is annoying and can (rarely) cause the game to crash. Again, just be sure to disable effects, before opening the map, and don't re-enable effects until after that map has been closed for a second, _or better yet,_ **just use one of the included AHK scripts to make the fix fully automatic so you never need to worry about it.**

- The included AHK scripts require [AutoHotkey](https://www.autohotkey.com/), which is an awesome utility that everyone should have at least a little basic knowledge of.

**Important Safety and Security with AutoHotkey**

It is strongly recommended never running AHK scripts downloaded from untrustworthy sources without first viewing them in a text editor and confirming that they aren't doing anything nefarious, or are too far beyond one's own comprehension.

In that regard, I don't presume to be considered a trustworthy source, so you should definitely view my scripts as text before running them. Just right click on the .ahk files that I've included and choose either "Edit," or "Open in notepad," or better yet "Open in notepad++," and look through the scripts for yourself.

There are two .ahk files, one for AHK v1.1 and one for AHK v2.0. They are both very simple hotkey scripts, and they are well commented to explain what they are doing at each step. AutoHotkey includes extensive documentation with installation of the application too (not my scripts, but the scripting engine itself, which is trustworthy), so any functions in my scripts that you are curious about, can be easily looked up in the help docs.

Even if you aren't a coder, scripter, or AHK expert, it should be easy to tell that these scripts aren't doing anything suspicious. They do need to run as admin in order to send inputs to RDR2, thus they are written so as to request admin privileges when first started, requiring a UAC confirmation, there really isn't any way around that though, because RDR2 is a protected process... well technically, with the AHK v2 one, it can work when run with UI access instead of as admin, but less consistently (comment out the Admin section and uncomment the UI Access section in the ReShade_RDR2fix_Map_AHKv2.ahk file if you want to try it that way).

Anyway, welcome to experiment, and by all means offer me some pointers if you have any, as I'm a complete novice with AHK. I'm amazed that I was even able to get these AHK scripts working for this mod, despite how basic they are. Normally such simple hotkey scripts would be even more basic, but well, RDR2 has... issues, lol.


### **Version 1.0 Compatibility Info**

- For this not to break the games UI the "safe zone" configured through the in-game display settings must be set to 90% horizontal and vertical. _if anyone knows where/how to set "safe zone" lower than 90% through game's config files, please let me know. Edit: I found a way to adjust safe zones much lower, but not in a way I can easily mod without writing an .asi script mod, which is over my head - maybe I'll provide DIY details for Vulkan users if there is interest_.*Fixed in V2.0 for DX12, which no longer needs to adjust UI safe zones, because the mod works beneath the UI

- Version 1.0 also includes a ReshadeEffectShaderToggler.ini file for use with the mod [Walk Speed Control and Auto-Walk](https://www.nexusmods.com/reddeadredemption2/mods/1491), which serves to keep that mod's walk speed ui elements from being pushed off screen, as I consider it an essential mod. Only works in DX12 as the REST addon for ReShade Vulkan support is not working at all for RDR2. *In V2.0 for DX12 ReshadeEffectShaderToggler.ini has been extended to include complete UI support for the game, fixing compatibility with vanilla UI, as well as most other mods that add any sort of UI element

- Most non-ReShade mods should work fine. Mods which add on screen UI elements outside of the games vanilla UI framework, and thus don't honor the UI safe zone (mostly only some script mods) could have their UI elements pushed off screen by this mod. If using the [Rampage Trainer](https://www.nexusmods.com/reddeadredemption2/mods/233) mod, the Rampage UI will be functional but the layout will have some minor alignment issues, just disable this mod with the hotkey while interacting with Rampage UI. *Fixed in V2.0 for DX12 for almost all mods, (rampage trainer only requires making an adjustment to its on screen placement within the Rapage trainer settings in V2, and it's alignment issues are almost completely fixed, most other mods should not have any issues)

- I wish I could get ReShadeEffectShaderToggler to play nicely with the game's shaders, so I could apply effects beneath the UI entirely, but if it's possible (the addon has limited support for DX12 & Vulkan), I haven't been able to figure it out. It generally causes the game to crash whenever I select any actually relevant shader, no matter what settings I've configured for the active shader group. I've tried almost every version of the addon, as well as multiple versions of ReShade. *Fixed in V2.0 for DX12, where the mod effectively uses REST to inject effects beneath the games UI, though I still can't get REST to work at all with Vulkan _If anyone can help with the ReShadeEffectShaderToggler, **please do reach out**._



# **The Whole Story**


Screen space shadows and screen space reflections can't be produced by off-screen elements, so some shadows/reflections are abruptly cut off around screen edges. Especially noticeable when tilting the camera causing objects to be cut off at angles that don't align with screen edges. This is a well-understood limitation of screen space effects, that are somewhat compensated for in most titles, aside from RDR2.


## Industry Standard Fixes

- **Over-render & Crop**
The first standard method of reducing the worst artifacts of screen space effects is to over-render (rendering a larger area than the viewport's size) and crop before outputting image for display. This way elements slightly outside the viewport are still rendered and influence screen space effects. The performance cost of rendering a larger image than will actually be displayed must be balanced against the improvement in image fidelity, by only over-rendering to a limited degree. When over-rendering and cropping, UI elements must be accounted for.

- **Alpha-mask/Fade**
After over-rendering and cropping, it remains likely that some screen space reflection/shadow casting elements will still fall outside the rendered image area causing their visible reflections/shadows to be cut off abruptly. These remaining artifacts should be softened to make them less jarring and noticeable by adding alpha-masking at the edges of screen space reflections/shadows, or otherwise fading the effect out, rather than cutting it off with hard edges.


## RDR2 is Kind of Special

This game apparently employs neither of the methods described above in order to compensate for the obvious shortcoming of the screen space shadows and reflections that are used extensively in the title. Well, too be fair, I think they have actually employed both methods in RDR2, at least to some extent, and on the vertical axis the screen space effects don't look too bad, but on the horizontal axis, it seems like something is broken.

Ideally Rockstar would release a patch to fix the often broken appearance of these effects. Of course, screen space effects aren't perfect, and will never appear to be perfect, but they shouldn't look like garbage either, and industry standard approaches to compensating for their shortcomings should be expected from triple A developers.

The next best thing would be for some skilled modders to tackle these issues by devising a way to get RDR2 to over-render and crop internally and alpha-masking/fading the edges of screen space effects (more effectively at least, on the horizontal axis). I do believe that RDR2 does have these capabilities under the hood somewhere. I think it even is doing some degree of over-rendering but then it is scaling instead of cropping or something silly like that (even with resolution scale and dlss/fsr disabled). Unfortunately tackling this issue with a proper RDR2 mod is well over my head.

Thus the _**next** next_ best thing... **this ReShade workaround fix before you**. Still, this method should really be applied beneath the UI elements **(in V2.0... it is)**, and the ReShade addon _ReShadeEffectShaderToggler_ by _4lex4nder_ that this preset makes limited use of for the [Walk Speed Control and Auto-Walk](https://www.nexusmods.com/reddeadredemption2/mods/1491) compatibility (in V1.0, and for everything else including, in V2.0), should be able to handle just that (it can, and it's fixed in V2.0 for DX12), but I haven't been able to get it to work effectively without crashing the game but I haven't been able to get REST working for Vulkan in RDR2. _So any help trying to work out the issues with that would be greatly appreciated._