CyberFSR2
CyberFSR2 copied to clipboard
idea: rebrand as a drop in replacement for DLSS
as stated in the mod description, in THEORY could be used in other games.
Here is the idea: rebrand the project as a "dlss2fsr". once its stable. Maybe now is the time of doing that instead of more down the road when there are cyberpunk specifick hacks.
is this idea crazy?
regards
a guy who has no clue on gamedev and is actually a web developer
No, your idea is not that crazy. Actually, I've thought of something like that myself. I just need the time and access to the other DLSS games to actually do it. Still, I'm going to have to tweak the project for every single game anyways, so it doesn't really matter if I start with cyberpunk or any other game. Odds are I'll be able to use code and findings from cyberpunk for other games.
Your project is literally DXVK, but for FSR 2.0, this has the possibility to gain a lot of momentum, I completely endorse the idea to evolve this project into a bigger thing. Doing game specific tweaks seems unavoidable yeah, but DXVK does it as well, there isn't a very huge list of DLSS 2.0 games though, and even less that really benefits from it.
I can't wait to see in other games. You are the best. I can finally play cyberpunk with my GTX 1660 super and my 4k monitor.
Totally agree, would be great to see it in other games like Metro Exodus.
I vouch. If this mod globally works on most games with DLSS support then this project will be a big one for sure!
I am very happy to report that I successfully got this mod working with Dying Light 2 (changes, download).
I'll describe some of my findings here (I apologize for the large comment):
-
Dying Light 2 checks
SuperSampling.FeatureInitResult
instead ofSuperSampling.Available
to enable DLSS. -
To get/set the width and height, Dying Light 2 uses
DLSS.Render.Subrect.Dimensions.Width
andDLSS.Render.Subrect.Dimensions.Height
instead of justWidth
andHeight
. This was the biggest obstacle to getting FSR 2.0 working in the game. Before I added these parameters toUtil::NvParameter
and handled them inDx12ParameterImpl
, all 3D elements of the main menu and in-game were rendered as a black screen. I also found out thatffxFsr2ContextDispatch
returnsFFX_ERROR_OUT_OF_RANGE
when those parameter are not handled.
I'm not familiar enough with the DLSS API to know if these parameters are a standard way to check for and use DLSS, but adding them does not interfere with the parameters that Cyberpunk uses. If the goal is to support as many DLSS games as possible, investigating and implementing the parameters that different games use is an important part of the process.
I tried to implement ViewMatrixHook
in the same way as it is done for Cyberpunk2077.exe
, but unfortunately quickly ran into some difficulties. Although I could find the vertical field of view value in the game's memory, I couldn't get a static address to it or find the near/far plane values at all. Luckily, from my testing it seems that these values are not as important as I expected (at least in Dying Light 2).
-
For the field of view, while using a lower value than the actual in-game FOV reduces the image quality, using a larger FOV did not appear to change the image quality. I hardcoded
ViewMatrixHook::GetFov
to return a vertical field of view of 77, the largest value possible to set from the in-game menu. When I decreased the in-game FOV to the minimum of 47, the image quality appeared to be good even though the FSR 2.0 library was receiving a larger value. Even in Cyberpunk, using a larger FOV for FSR than the in-game value did not appear to change image quality. -
For the near/far plane values, I set them to as large of a range as possible. Specifically,
ViewMatrixHook::GetNearPlane
returned zero andViewMatrixHook::GetFarPlane
returned a floating point infinity value. I am less certain that these values will work in other games, especially since the far plane "is used only used in case of non infinite depth", but it seemed to work fine in Dying Light 2.
If using fixed values like these works for most other games, it would be possible to provide suitable defaults for the ViewMatrixHook
functions and only access the game's memory for the actual values if necessary. To do that, the mod would need to check the output of GetModuleHandleW
to make sure it's not zero before dereferencing a possibly invalid memory address on the next line.
I hope some of the information here will be useful for anybody trying to get FSR 2.0 working in other games. In the meantime, I'll try to send PRs for some of the fixes and changes. I too hope that this can be a drop-in replacement for DLSS in the future.
Finally, I want to thank you directly, @PotatoOfDoom, because you made it possible for me to run both Cyberpunk 2077 and Dying Light 2 with better performance and minimal quality loss. I appreciate that both AMD's FSR 2.0 and this mod is open source as it makes it possible to add better upscaling to these games when the game developers haven't done so already.
@mnxn First of all, thank you for your contributions. I agree with your first 2 points and have already merged your PRs.
Regarding the ViewMatrixHook
thing: I know it is really a barebones solution right now and nothing really substantial. I didn't touch it yet because I want to refactor the entire codebase anyways.
I think another solution for now would be to put the ViewMatrixHook
values into an ini file next to the dll. That should make editing depth and fov easy enough for users until someone with cheatengine knowledge properly fetches those values.
An ini file is an excellent idea and I can't believe I didn't mention it. Some users on Nexus have also expressed interest in tweaking other settings for the upscaling, so an external configuration file is definitely the way to go.
Just thought I'd chime in, thanks to @mnxn using their version it appears to also work in Guardians of the galaxy! There is some weird artifacting but it definitely works!
Edit: Should point out that the artifacting was using Ultra Performance mode, and it doesn't seem to be present in higher qualities, at least not the the same effect.
@ABagOfPotato did you tried on other games as well?
@GabrielSVieira97 Metro Exodus Enhanced Edition
Okay. So far, in my tests, GTX 1660 super, 4k monitor. The cyberpunk works very well, the @mnxn dying light mod I tested in Marvel's Guardions of the galaxy and it's pretty good too, except for the ultraperfomance mode that does not work. The red dead mode is really bad in my game, tooo much flickering, at least for now, in any mode. Didn't test dying light or metro exodus, cause I don't have thoses games, but I did tried the @mnxn one in control, it does work, but bad, too much ghosting in that game, probably cause of the way of the game. But it's a blessing seeing this works in games, hope you guys keep working. I apreciatte a lot!! Thanks.
Now that #11 is merged and this version of the mod supports multiple games, I think the project can start rebranding.
@PotatoOfDoom: what do you think?
@mnxn @PotatoOfDoom It would be awesome to have some guide or video to "noobs", like me, on how to use the ini file corretctly in others gamers. Or maybe some list were people can post the values that they are using in others games. Thanks anyway 😃.
What about IU2FSR? 🤷 Image Upscaler to FSR?
We probably should create a compatibility chart too. I just tried Death Stranding Director's Cut and Master branch works.
Found this, might be useful. I don't know who the source is, though. https://docs.google.com/spreadsheets/d/1XyIoSqo6JQxrpdS9l5l_nZUPvFo1kUaU_Uc2DzsFlQw/edit?disco=AAAAdL7GHNM#gid=0
@koffiato that's the official spreadsheet pinned on the Discord server. It's by @AkiraJkr
@TheRazerMD we should incorporate this into readme for easy access. I already created a PR and this'd be a good addition imo