New Contrast Adaptive Sharpening from AMD
- lowenz
- Topic Author
Please Log in or Create an account to join the conversation.
- JBeckman
Not that I know very much about shaders, mostly using the adaptive sharpness effect(s) (One with depth buffer and the other without for games with limited or no depth buffer hook for ReShade.) and I haven't looked it up too much for how it really works in the shader code itself plus what other sharpness shaders there are since I think there's two or three at least.
Neat!
EDIT: Hmm wonder if it could work similar to SMAA with the .fxh being the source well I wouldn't really know, lots of interesting little options in there though.
Please Log in or Create an account to join the conversation.
- BeTa
edit:
on second thought..
Damn that thing is complex... --> github.com/GPUOpen-Effects/FidelityFX/bl...as-headers/ffx_cas.h
i guess not in the foreseeable future...
Please Log in or Create an account to join the conversation.
- Iddqd
link: gist.github.com/SLSNe/bbaf2d77db0b2a2a0755df581b3cf00c
Please Log in or Create an account to join the conversation.
- Martigen
I've seen more complex shaders. But if anyone can port this, Marty can @MartyMcFlyBeTa wrote: the question is, can we salvage it or parts from it for benefiting ReShade or its shaders?
edit:
on second thought..
Damn that thing is complex... --> github.com/GPUOpen-Effects/FidelityFX/bl...as-headers/ffx_cas.h
i guess not in the foreseeable future...
Please Log in or Create an account to join the conversation.
- Marty McFly
I don't know if the license allows for porting this to ReShade, technically HBAO+ is also open source but we can't port it to ReShade due to its license - I ported HBAO+, but can't release it.
This shader here is mostly that huge because they unrolled everything (instead of do x 10 times it's do x do x do x....), optimized it for GCN architecture and also it is in compute shader format so there's things that can't be done pixel shaders like that. Doesn't mean though it's impossible to port to ReShade though, I'd rather look at the documentation which is above and recreate it.
EDIT: checked it. seems that this port iddqd posted is pretty close already, scaling is not required as this feature would be an upscale sharpener, so raise resolution and at the same time sharpen.. CAS go slower is also fine, and better diagonals as well, since the shader itself is so fast already, it doesn't matter.
EDIT2: vectorized math, that makes it much easier to read, no reason to do all operations separately except on GCN. Left most of it as is, except the last part, restructured it so it compiles to less instructions and more independent calculations so that might be less cycles, idk.
pastebin.com/iUmDXTVP
Please Log in or Create an account to join the conversation.
- Qsimil
Marty McFly wrote: Damn, this comes at an awkward moment, I was just about to release a qUINT sharpen shader, now everyone would think I stole this when I release it for everyone
I don't know if the license allows for porting this to ReShade, technically HBAO+ is also open source but we can't port it to ReShade due to its license - I ported HBAO+, but can't release it.
This shader here is mostly that huge because they unrolled everything (instead of do x 10 times it's do x do x do x....), optimized it for GCN architecture and also it is in compute shader format so there's things that can't be done pixel shaders like that. Doesn't mean though it's impossible to port to ReShade though, I'd rather look at the documentation which is above and recreate it.
EDIT: checked it. seems that this port iddqd posted is pretty close already, scaling is not required as this feature would be an upscale sharpener, so raise resolution and at the same time sharpen. CAS go slower is also fine, and better diagonals as well, since the shader itself is so fast already, it doesn't matter.
EDIT2: vectorized math, that makes it much easier to read, no reason to do all operations separately except on GCN. Left most of it as is, except the last part, restructured it so it compiles to fewer instructions and more independent calculations so that might be fewer cycles, idk.
pastebin.com/iUmDXTVP
Does HBAO+ shader exist for Patreon supporters?
Anyway that CAS shader looks great, thanks works fine in Division 2 DX12.
Please Log in or Create an account to join the conversation.
- BeTa
This works also in Wreckfest.. and its pretty also.. Is it better then FilmicAnamorphSharpen or FilmicSharpen?
Im not really shure... But i think CAS looks a bit more agressive, but could be cause you cant fine tune it like teh Filmic ones..
Theres only one thing that bothers me.. Even at "0" theres still sharpening applied.
Guess needs to be modified a bit.. But hey, this is great stuff and i just wrote this yesterday.. Damn u are a fast one..
Please Log in or Create an account to join the conversation.
- Niko of Death
I assume this would be optimized more for RDNA rather than GCN, seeing as the universal implementation (Radeon Image Sharpening) is only available on Navi cards. Although perhaps the architectures are similar enough that the same optimizations apply to both.Marty McFly wrote: Damn, this comes at an awkward moment, I was just about to release a qUINT sharpen shader, now everyone would think I stole this when I release it for everyone
I don't know if the license allows for porting this to ReShade, technically HBAO+ is also open source but we can't port it to ReShade due to its license - I ported HBAO+, but can't release it.
This shader here is mostly that huge because they unrolled everything (instead of do x 10 times it's do x do x do x....), optimized it for GCN architecture and also it is in compute shader format so there's things that can't be done pixel shaders like that. Doesn't mean though it's impossible to port to ReShade though, I'd rather look at the documentation which is above and recreate it.
EDIT: checked it. seems that this port iddqd posted is pretty close already, scaling is not required as this feature would be an upscale sharpener, so raise resolution and at the same time sharpen.. CAS go slower is also fine, and better diagonals as well, since the shader itself is so fast already, it doesn't matter.
EDIT2: vectorized math, that makes it much easier to read, no reason to do all operations separately except on GCN. Left most of it as is, except the last part, restructured it so it compiles to less instructions and more independent calculations so that might be less cycles, idk.
pastebin.com/iUmDXTVP
Please Log in or Create an account to join the conversation.
- BeTa
--> www.reddit.com/r/Amd/comments/cc0575/i_p...shade_so_anyone_can/
I ported FidelityFX CAS to ReShade so anyone can use it, with nearly any game
Discussion
Download ffx_a.h and ffx_cas.h from the GPUOpen repository (click "Raw" then you can Ctrl-S the file)
github.com/GPUOpen-Effects/FidelityFX/tr..._CAS/ffx-cas-headers
Download my wrapper shader and save it as FidelityFX_CAS.fx (same again, "Raw" then save)
pastebin.com/yyTqn7Xh
Put all three files in your ReShade shader folder
Tweak the sharpness parameter to your liking. AMD recommends leaving it at 0.0 for minimal artifacts but it can be increased up to 1.0 for more aggressive sharpening.
It will be a little slower than the driver version since ReShade doesn't support FP16/RPM, and I'm pretty sure this version won't work in DX9 games, but I've tested both DX11 and OpenGL games successfully. Looks pretty good to me.
Keep in mind that sharpening should ideally be done before film grain is added, otherwise the grain gets amplified, so for best results you may need to disable in-game film grain and instead apply a ReShade grain effect after CAS.
i guess he did it different? He included the Original FidelityFX files?
Whats the diff. between his and yours?
Please Log in or Create an account to join the conversation.
- jsheard
Please Log in or Create an account to join the conversation.
- Marty McFly
EDIT: So I compiled both versions and the wrapped one is faster and shorter, due to missing CAS_GO_SLOWER and CAS_BETTER_DIAGONALS which the other inline version has. When I enable these, I can see no visual difference but the wrapped one is 64 instructions where the one I optimized is 48. How that comes to pass, I'm uncertain, either way jsheard can't be blamed, he did everything correctly, so it's AMD code, probably also differences in compilers, since I use official DX FXC. The wrapped version has a lot of MOV operations (copies stuff around with no useful contribution).
Please Log in or Create an account to join the conversation.
- aaronth07
Please Log in or Create an account to join the conversation.
- Qsimil
Please Log in or Create an account to join the conversation.
- Marty McFly
Please Log in or Create an account to join the conversation.
- colesdav
I tested CAS.fx on BFV and compared to Smart_Sharp.fx here:
I wanted to test Metro Exodus on XBOX Game Pass for PC (Beta) but everything seems protected/ encrypted / locked down so I have not found a way to use ReShade.
Metro Exodus with Epic Games Installer is not working with ReShade for me either.
Thanks.
Please Log in or Create an account to join the conversation.
- aaronth07
Please Log in or Create an account to join the conversation.
- Viper_Joe
aaronth07 wrote: @colsedav What is smart sharp?
github.com/BlueSkyDefender/Depth3D/blob/...aders/Smart_Sharp.fx
Please Log in or Create an account to join the conversation.
- someone_for
Please Log in or Create an account to join the conversation.
- jas01
Please Log in or Create an account to join the conversation.