gamescope
gamescope copied to clipboard
Add support for FSR 2
I really don't see how this would be possible. FSR2 needs depth and motion vectors which we don't have access to.
@DadSchoorse I have a branch that can extract motion vectors on Deck here: https://github.com/Plagman/gamescope/tree/motion_vector_fun
May be interesting to hook up to this for for 'motion smoothing' for dropped frames. Using them to stretch the last frame out to fill in the gaps.
Even then we are still missing depth and viewport jitter.
Maybe reshade depth addon could be used as shared library with minimal modifications (in case you may want to share your findings/fixes later) https://github.com/crosire/reshade/blob/main/examples/07-generic_depth/generic_depth.cpp
DESCRIPTION = "Automatic depth buffer detection that works in the majority of games."
You can provide input to FSR2 without depth or motion vectors using the reactive mask, though I don't know what it'll produce if you do that for the whole image.
As some areas of a rendered image do not leave a footprint in the depth buffer or include motion vectors, FSR2 provides support for a reactive mask texture which can be used to indicate to FSR2 where such areas are
Sorry for my little understanding but I have an idea that I don't know if is useful or not.
- Can you talk with the video IP block (VCE) and ask for MPEG motion compensation (motion vectors) of previous frames?
- It is possible to ask the Vulkan group to extend the API to allow the GPU to talk with the video block for such a task?
maybe I am totally wrong but I hope someone thinks my idea is useful. thanks for your effort!
Sorry for my little understanding but I have an idea that I don't know if is useful or not.
1. Can you talk with the video IP block (VCE) and ask for MPEG motion compensation (motion vectors) of previous frames? 2. It is possible to ask the Vulkan group to extend the API to allow the GPU to talk with the video block for such a task?
maybe I am totally wrong but I hope someone thinks my idea is useful. thanks for your effort!
1 wouldn't that be FSR 3? if you have access to that data (motion vectors) couldn't you interpolate frames? 2 I think thats what reshade does, and it gives access to depht to shaders like rtgi.
can this be a relevant paper for this question??
https://jcgt.org/published/0010/03/02/
I didn't see it mentioned, there is TFAA by JakobPCoder, it uses an estimation of motion vectors and depth to implement "TAA" as a reshade shader. Here is a comparison with the original crysis:
No AA:
TFAA:
To use it:
-
Install vkBasalt
-
Configure reshade
- Download the reshade shaders (clone the repo or download the files)
- In
vkBasalt.conf
, set the paths to the downloaded repo:
reshadeTexturePath = "/home/user/.config/vkBasalt/reshade/textures" reshadeIncludePath = "/home/user/.config/vkBasalt/reshade/shaders"
-
Download the
TFAA
files here and put them into theshaders
folder. -
Download the
Motion Vector Approximation
files here and put them into theshaders
folder. -
Set the path to the
TFAA
shader invkBasalt.conf
:tfaa = "/home/user/.config/vkBasalt/reshade/shaders/TFAA.fx"
. -
Set the path to the
DRME
shader invkBasalt.conf
:drme = "/home/user/.config/vkBasalt/reshade/shaders/MotionEstimation.fx"
-
Configure the effects, e.g.:
effects = smaa:fxaa:drme:tfaa
.
With TFAA looks good, there is some way to use Color Buffer/Motion Vector Approximation to make FSR 2 on gamescope?
If TAA and FSR have similarities, can i presume that this will be possible in any way???
And Vkbasalt is descontinued, it's hard to do something like reshade GUI to use on gamescope ?? (to load reshade code etc)
Seems that AMD released a source code for FSR 2.2 https://community.amd.com/t5/gaming/amd-fsr-2-2-now-available-on-gpuopen-and-fsr-supported-in-250/ba-p/586393
any updates?
i am also interested in FSR 2 support. is there any progress in figuring out if it is possible? people seam to have a good amount of interesting/promissing idea in this thread and with the source open i hope this becomes possible.
also interested
I don't think it's possible due to the way FSR 2 works. It requires motion vector that's only available inside the game itself, and Gamescope has no way to know it. I think this can be closed as not solved
?
TAA too, and there is some kind of solution provided by reshade to mimic the original TAA.
Since FSR2
is the FSR1
+builtin AA
just slap an optional FXAA
before FSR
/NIR
and call it a day ;)
Additionally if the FSR
option enabled and any AA
(add SMAA
too, maybe) option not enabled then just warn in console that it is recommended to use AA with the FSR option and user should either enable AA in the game options or here.
I doubt there will be a big difference between the builtin fake motion/depth
+FSR2
and the current any AA
(external)+FSR1
(gemascope). When using game's final image as a source.
But any AA external will be inject after FSR (gamescope), or not?
@charmandercha
But any AA external will be inject after FSR (gamescope), or not?
It's a bit tricky but not impossible for user to control this. For example try enable an AA vulkan layer before gamecope and disable before application (or keep and get "two pass AA" :) ).
ENABLE_AN_VKAA=1 gamescope -- env DISABLE_AN_VKAA=yesplease vkcube
IIRC vkbasalt have special handling in gamescope, try something else if it will not work.
If it will work then someone should benchmark this and show as some before/after screenshots, cpu/gpu load and fps ;) .
EDIT: or not. I'm tired and a bit confused now. Should try this by myself later.
Could be just gamescope -- env ENABLE_AN_VKAA=1 vkcube
, we need to apply everything to application before gamescope will FSR it (?).
Since FSR2 is the FSR1+builtin AA just slap an optional FXAA before FSR/NIR and call it a day ;)
Although not exactly accurate but I fully support this. FSR
+ FXAA
produces fine image even in low-res scenarios with few of extreme blurry spots and pixel artifacts. This is GTA V running at 621p upscaled to almost 1080p with internal FXAA
and Gamescope's FSR
enabled.
Witch AA is more eficient?
There is any chance to use this method with lowest input possible and receive any good results?
Like 720p (trying to be realistic in there but i wanna 540p) to scale to 4K.
But there is anothers AA like CMAA2, somente know if there is version of it for vkbasalt? or another AA with results better than fxaa?
So, FSR3 have the builtin AA ... good, let's do a poor man's FSR3 step-by-step ;) (I'm not expert in this things, but I'm a random dude from the internet, so trust me)
-
Prepare (game's side)
- Disable some in-game post-fx Film grain, etc.
-
LOD Bias
They have a formula but just experiment with the simple values like -0.4, -0.7 or -1. More is better for FSR but will introduce additional shimmering which will be "doubled" by FSR.
I's e.g
STRANGLE_PICMIP=-1
(libstrangle) ord3d11.samplerLodBias = -1.0
(dxvk) -
AA
Well, the maximum in-game or external AA you can afford.
It's e.g
effects = smaa:fxaa
(vkbasalt) -
Frame limiter
Do not torture your HW, apps should not own all available system resources. Despite they usually act like they do.
If crontab, notification, etc. will spawn in background during gameplay your framerate will go brrr.
It's e.g.
STRANGLE_VSYNC=0 STRANGLE_FPS=40
(libstrangle) or alternative. -
"Frame generator" ;)
It's e.g.
STRANGLE_FPS=60
(libstrangle) andd3d9.presentInterval=2
ordxgi.syncInterval=2
(dxvk). In this case app will run at 30 fps but will look like 60 fps. Will cost you some in-game responsiveness though.
-
"FSR" (Spatial Upscaling) I'm not completely sure if it should have built-in sharpening step enabled in our case. Also I didn't dug too much (at all) into the algorithm, but I think the sharpening step could be the separate step also. Either before or after the upscaling step (e.g. CAS via vkbasalt). Or even disabled.
Via gamescope, fs-hack, etc.
A real poor man could use the WM compositor's Zoom effect. I tried the KDE kwin zoom on an old screenshot from a random game (where I used negative lod bias, etc.) and the resulting image is kind-of acceptable.
-
Post-process Add additional sharpening, post-fx, etc.
In case some people want to tinker a bit ;)
EDIT: For those wondering how to use pre- and post fx- with gamescope:
Since they disable vkbasalt env var here https://github.com/ValveSoftware/gamescope/blob/0f0c5eba08666ca3494bad1bc07e567dd3e7f35c/src/steamcompmgr.cpp#L6283
it could be something like:
ENABLE_VKBASALT=1 VKBASALT_CONFIG_FILE=/path/to/post-fx.conf gamescope -- env ENABLE_VKBASALT=1 VKBASALT_CONFIG_FILE=/path/to/fx.conf run_game
Full variant:
ENABLE_VKBASALT=1 VKBASALT_CONFIG_FILE=/path/to/post-fx.conf gamescope -- env ENABLE_VKBASALT=1 VKBASALT_CONFIG_FILE=/path/to/fx.conf ENABLE_VK_LAYER_TORKEL104_libstrangle=1 STRANGLE_VSYNC=0 STRANGLE_FPS=60 DXVK_CONFIG="[gamename.exe];d3d11.samplerLodBias=-1.0;dxgi.syncInterval=2" run_game
I didn't tested it though.
Replying to https://github.com/ValveSoftware/gamescope/issues/615#issuecomment-1693764206
I did not understand anything but it's because i do not know anything about this things lol
But, if anyone tries this visually enhancing method, could they post it here for others to see?
+1
https://gpuopen.com/fsr3-source-available/
I am wondering, with AFMF finally released, if there's a way Gamescope will get an equivalent to that, as it essentially works with any DirectX 11 or 12 game that uses Flip Composition (And this can include OpenGL and Vulkan games with an interop or AMD's OpenGL optimizations option in their control panel).
+1 for this request please!