nipkownix / re4_tweaks

Fixes and tweaks for the "UHD" port of Resident Evil 4
zlib License
340 stars 32 forks source link

Make "fix blurry image" work with driver level supersampling / dxvk sample rate shading #581

Open Deus-nsf opened 11 months ago

Deus-nsf commented 11 months ago

I noticed that when driver level SSAA (SGSSAA) is enabled (that or DXVK sample rate shading), the fix blurry image option doesn't change the image clarity, it is unfortunate as only using MSAA doesn't clean up the image very well, while supersampling has perfect image with 0 aliasing, but is blurry. Even forcing negative lod bias, while working, doesn't help with clarity. I was wondering what this option do, as a similar kind of problem can be observed on Black Mesa (different game and engine but maybe there's a root of evil).

Maybe there's some hack that can be upstreamed to DXVK to fix this sort of issue but for other edge cases in other games? Thanks!

Markie98 commented 11 months ago

What does sample rate shading do in DXVK?

Deus-nsf commented 11 months ago

What does sample rate shading do in DXVK?

Pretty much the same as driver level full scene supersampling :) so it also makes fences, all transparent objects like vegetation etc have a supersampling pass, so it's not just like MSAA where it only smoothes object borders, it's like rendering the game at a much much higher resolution and then downsampling it.

Nvidia DSR or AMD VSR are a way to achieve this easily, but the problem is that they only work well with 4x the resolution, for example I have a native 1440p display, so it would be 2880p, which looks amazing don't get me wrong, but can be very hard to run (especially del lago fight because of all the water splashes that destroy FPS), what's great about driver level supersampling or dxvk sample rate shading, is that they allow 2x, 4x, and 8x (for the craziest of people haha), not just 4x. Also, using DSR or VSR can introduce some issues with scaling etc... Which do not happen with the other methods.

Markie98 commented 11 months ago

You're saying it also treats alpha transparencies, so it's more akin to SGSSAA than OGSSSAA through Nvidia Profile Inspector?

Deus-nsf commented 11 months ago

exactly ! and SGSSAA will have the exact same issue, it will still look blurry despite the much higher sampling

Markie98 commented 11 months ago

I see, thanks. SGSSAA looks fine to me in the game, somewhat blurry but only as expected, nothing too bad. You have to use the AA fix with the 0x000000C1 flag in this game mind you.

EDIT: Just tested it and the Fix blurry image setting works both with SGSSAA and DXVK's sample rate shading, but it turns out you actually have to keep the AA fix disabled if you're using it alongside SGSSAA to get a properly sharp image, curiously.

Deus-nsf commented 11 months ago

Interesting, I will have to try this as I'm still on an Nvidia GPU, but since it has to use an Nvidia driver compatibility flag, it means that it wont work with DXVK (which is crucial for CPU performance, see this video of mine: https://youtu.be/d1KYs6kY_rY?si=z5AJHKl1R-z5R68v) since DXVK ignores driver level overrides, also the advantage with DXVK sample rate shading is that it works on all GPU vendors, not just Nvidia ;)

Markie98 commented 11 months ago

Nice, good video. Yeah the performance uplift is substantial both on the CPU and the GPU with DXVK. But I don't use it in this game as I like to use NVCP FXAA + ULLM + Vsync (Standard... Adaptive seems to randomly break in this game, not sure if because of W10, re4_tweaks, ReShade, some combination of those, or because of how the game behaves). I also use ReShade with the ReshadeEffectShaderToggler addon so that MXAO and another shader skips the UI/HUD/cutscenes so while I'd still be able use ReShade and my shaders of choice under Vulkan that tweak would be lost as REST only has support for DX9/10/11 + 12 as a WIP for now and for me this is too big of a downside to take. That and also losing SGSSAA (or OGSSAA in this case to avoid issues with ReShade as explained here), if I had spare performance for it on top of everything anyway.

Deus-nsf commented 11 months ago

Ah, that's a bummer than REST doesn't support Vulkan! In the future, hopefully :) as for the loss of driver level supersampling I guess DSR / VSR does the trick too since it's the exact equivalent to OGSSAA x4. I know OGSSAA can get up to x16, but honestly with modern displays and resolutions the difference is non existent. This was mostly useful for 1080p or below :)

Markie98 commented 11 months ago

I know, as I said in the linked post on guru3D I use OGSSAA in a way that makes it similar to SGSSAA so it's not just a raw SSAA/downsampling look, but thanks.