Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fshack: Add faking current resolution ability #52

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

Dragomir-Ivanov
Copy link

@Dragomir-Ivanov Dragomir-Ivanov commented Jan 30, 2022

Hi,
I have made this patch, in order to make Diablo 2 Resurrected to work with FSR fullscreen scaling.

In D2R there is no ability to select fullscreen resolution. The game sets itself automatically to the current monitor resolution (your desktop resolution that usually matches your monitor native resolution). Doing so, FSR can't do its thing.

There is in-game resolution scaling, but it is no match to FSR.

What this patch does, is reporting fake current screen resolution selected via envvar WINE_FULLSCREEN_FAKE_CURRENT_RES, so that D2R can use this resolution as current, and then FSR can upscale to the real monitor resolution.

Example:

WINE_FULLSCREEN_FSR=1 WINE_FULLSCREEN_FAKE_CURRENT_RES=1720x720 %command%

The command above will use Performance FSR mode starting the game at 1720x720 resolution, and FSR will take it to 3440x1440.

@sigboe
Copy link

sigboe commented Feb 14, 2022

Oh wow, this will also help for me! Thank you!! I have a monitor that is one of the first consumer monitors with gsync built in, and the driver board has no scaling functionality. Since Nvidia made the driver board design, all of the resolution scaling and switching is courtesy of the Nvidia driver, which works transparently in Windows, but on linux xrandr and video games only sees the native resolution reported by the EDID. And to force a lower resolution I need to use the Nvidia X Server Settings, which uses metamodes to set resolutions. So every game I set to fullscreen, only shows the native resolution.

@somewhatfrog
Copy link

I've just tried to use it with Dark Souls 3 and this setting breaks windowed mode, just black screen with sounds from the game, menus seems to work, but nothing is shown.

@OnikenX
Copy link

OnikenX commented Feb 19, 2022

I've just tried to use it with Dark Souls 3 and this setting breaks windowed mode, just black screen with sounds from the game, menus seems to work, but nothing is shown.

@kindagoose fsr doesn't work with windowed mode, only works in fullscreen, you can put your window in fullscreen with alt+enter

@GloriousEggroll
Copy link
Owner

I've just tried to use it with Dark Souls 3 and this setting breaks windowed mode, just black screen with sounds from the game, menus seems to work, but nothing is shown.

As noted by OnikenX, FSR only works when the game is in Fullscreen mode. It does not work with Windowed or Borderless WIndowed modes.

@IceDBorn
Copy link

Can we use this to select resolutions higher than our native?

@somewhatfrog
Copy link

somewhatfrog commented Feb 20, 2022

@OnikenX @GloriousEggroll yes, but FSR alone doesn't break the game if you need to switch to windowed mode. While with this extra setting game breaks.

@Dragomir-Ivanov
Copy link
Author

@kindagoose I didn't tested with other games, nor windowed modes. Usually if you want to play windowed, don't use the setting. If you find the cause for your breakage I will be glad to fix it.

@8836290
Copy link

8836290 commented Mar 12, 2022

Does this work with Unity games that even though you set the ingame resolution to 720p on a 1080p monitor the game engine resizes the game to 1080p?

@Dragomir-Ivanov
Copy link
Author

@8836290 Should work. Best try it.

@ChthonVII
Copy link

Just stopped by to say that, not only does this look better than D2R's native resolution scaling, but the performance is dramatically better too.

@Dragomir-Ivanov
Copy link
Author

Just stopped by to say that, not only does this look better than D2R's native resolution scaling, but the performance is dramatically better too.

Do you use this feature? I also do think that D2R is a perfect game for FSR 1 advertisement.

@AHandheldFan
Copy link

Using this for other games with env variable set at 1920x1080 on a 4K monitor.
Do I set the in-game resolution to 1080p also? Or do I leave it at 3840x2160 (native).

@AHandheldFan
Copy link

Bump

@salt431
Copy link

salt431 commented Jun 22, 2022

im getting an issue with this where it makes the game window unfocused and nothing is inside of it until you alt+f11 into it, and the fsr works, but some UI elements cannot be clicked, as if the rendered resolution is the only area where mouse input is accepted and everything outside of it cannot be clicked. it can be seen but not clicked

@salt431
Copy link

salt431 commented Jun 23, 2022

Using this for other games with env variable set at 1920x1080 on a 4K monitor. Do I set the in-game resolution to 1080p also? Or do I leave it at 3840x2160 (native).

this is meant for games where its not possible to set an in-game resolution. for you just use normal fsr and set the resolution in game to any resolution below your monitors current resolution, and fsr will automatically upscale from the selected res to your monitors res

@Dragomir-Ivanov
Copy link
Author

@salt431 Yes, there is an issue, where if there is some pre-rendering fullscreen UI interface, like a launcher, it will be constrained also for the resolution set. This is a problem, that I can't imagine how to solve currently.
This patch best works, when the game starts itself in fullscreen, right away, without any launchers, etc.

If there is some setup you need to do before that, you need to do it without the ENV var, then as a last step is to set fullscreen option in the game, and close it, and start it again with the ENV var. If you still have some kind of a launcher you can't escape, mouse will not work correctly, but try using the keyboard only, and the TAB/Shift-TAB to cycle between the fields of the UI.

@GloriousEggroll
Copy link
Owner

GloriousEggroll commented Jun 26, 2022

Yes, there is an issue, where if there is some pre-rendering fullscreen UI interface, like a launcher, it will be constrained also for the resolution set. This is a problem, that I can't imagine how to solve currently.

This is a problem with this implementation of FSR in general as well as all externally-applied FSR options (such as gamescope). In order for UI items to not be affected the game itself must have its own internal FSR rescaler. This is not something we can control.

@salt431
Copy link

salt431 commented Jun 26, 2022

Lossless scaling (a windows upscaler for windows machines) can perform the same task and I can click all of the ui elements without any issues.

@GloriousEggroll
Copy link
Owner

Lossless scaling (a windows upscaler for windows machines) can perform the same task and I can click all of the ui elements without any issues.

You're comparing a paid, licensed windows application to an open source, community-provided hack on linux. Two completely separate things here. We're only able to work with what the author provides here, and to be honest this may even be going away soon. The FSR hack getting old and the author is not updating it in favor of using gamescope, but neither can control the UI scaling.

@darkbasic
Copy link

darkbasic commented Mar 12, 2024

In order to get it working I had to set both WINE_FULLSCREEN_FSR=1 and WINE_FULLSCREEN_FSR_STRENGTH=2 together with enabling the Exclusive fullscreen option in the game.
Removing any of the previous env variables was enough to disable FSR.
Version used is GE_Proton9_1.

@Dragomir-Ivanov
Copy link
Author

@darkbasic Thanks for sharing. Quite a bit of time has passed since that patch, so Proton surely added more features.
What game you are playing though?

@darkbasic
Copy link

darkbasic commented Mar 12, 2024

Rise of the Tomb Raider. I'm using the Windows version because the native one is slower and it's stuffed with issues: there is no audio unless I use this workaround (https://wiki.archlinux.org/title/Steam/Game-specific_troubleshooting) and when I use gamescope (which I have to if I want to use FSR) the mouse moves the camera only horizontally and not vertically in game (but it works fine in the menu and/or without gamescope). I'm using Gnome on Wayland which also gives me another annoying issue with gamescope: ValveSoftware/gamescope#985
Last but not the least the Windows version looks slightly better IMO.

EDIT: now that I think about it the audio issue could have probably been solved by installing pipewire-alsa, but proton is the superior solution anyway.

@loathingKernel
Copy link

loathingKernel commented Mar 12, 2024

Removing any of the previous env variables was enough to disable FSR.

WINE_FULLSCREEN_FSR_STRENGTH=2 is not strictly required but it can change how visible the RCAS effect is, changing your perception of FSR being enabled or not.

In any case, the patch of in this PR has not been part of ProtonGE since Proton8 because it was causing numerous issues and odd behavior to games.

@darkbasic
Copy link

Without WINE_FULLSCREEN_FSR_STRENGTH FSR doesn't get activated at all. Any value is enough to activate FSR, not just 2.

In any case, the patch of in this PR has not been part of ProtonGE since Proton8 because it was causing numerous issues and odd behavior to games.

Somehow the README claims that this patch is still valid (that's how I've found it). It also claim that WINE_FULLSCREEN_FSR is "Enabled by default since GE-Proton7-29" (it isn't) and that WINE_FULLSCREEN_FSR_STRENGTH defaults to 5 (while if you don't specify it FSR doesn't work at all).

P.S. I would love to report a bug instead of having to necrobump PRs but there is no way to. I've tried discord in the past, they told me the bug was valid but still no way to keep track of it.

@darkbasic
Copy link

darkbasic commented Mar 12, 2024

changing your perception of FSR being enabled or not

It's not a perception: I'm taking screenshots, putting them on different layers in my image editor and switching between them. Without both options (and Exclusive Fullscreen) there is no visual difference at all. Unless WINE_FULLSCREEN_FSR_STRENGTH=5 is such a low value to be indistinguishable to FSR disabled (which I doubt since your README states "the default sharpening of 5 is enough without needing modification") then FSR is clearly not working.

@loathingKernel
Copy link

loathingKernel commented Mar 12, 2024

FSR is the upscaling algorithm, RCAS which is controlled by the _STRENGTH variable is the sharpening. That is why I am mentioning your perception of it. The sharpening is more noticeable than the upscaling itself.

(and Exclusive Fullscreen)

Yes, this is a requirement for FSR in wine to work as in the case of Borderless Fullscreen there is nothing to upscale, since the window as seen from Wine's perspective is already at the proper resolution/dimensions.

You can compare the outlines of the letters between the two screenshots at 1280x800 on a 1680x1050 monitor to see what I mean. Here it looks like it is working correctly with using only WINE_FULLSCREEN_FSR.

WINE_FULLSCREEN_FSR=1 %command%
Screenshot_2024-03-12_14-36-12

WINE_FULLSCREEN_FSR=0 %command%
Screenshot_2024-03-12_14-39-08

It also claim that WINE_FULLSCREEN_FSR is "Enabled by default since GE-Proton7-29" (it isn't) and that WINE_FULLSCREEN_FSR_STRENGTH defaults to 5 (while if you don't specify it FSR doesn't work at all).

The readme is a bit outdated indeed. FSR was enabled by default at that time because the there were issues with the built-in proton upscaler when the FSR patch was applied on top. These issues have been fixed since, and FSR is not enabled by default any more. Also at some point the default sharpness was changed to 2 but quite possibly the history of doing so is lost in the continuous rebases of the patch. I cannot recall when and why it happened.

@darkbasic
Copy link

I've retested again and it looks like you're right, so maybe I messed up with the screenshot names. Anyway I confirm WINE_FULLSCREEN_FSR is disabled by default.

This is with WINE_FULLSCREEN_FSR=0:
Screenshot from 2024-03-12 14-18-56

This is with WINE_FULLSCREEN_FSR=1:
Screenshot from 2024-03-12 14-19-58

No WINE_FULLSCREEN_FSR_STRENGTH has been specified and the difference is clearly visible in the pictures (you don't even have to look at the text to notice, the portrait on the desk is clear enough).

@Dragomir-Ivanov
Copy link
Author

Guys, the meat of this patch is not FSR itself. The meat is that some games, don't allow you to specify Full Screen resolution, and pick display resolution as full screen. Looking at you D2R. This patch lies the game for the full screen resolution, then FSR to pick from there and do it's thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.