Welcome, Guest.
Username: Password: Remember me

TOPIC: New Contrast Adaptive Sharpening from AMD

New Contrast Adaptive Sharpening from AMD 1 week 1 day ago #1

The administrator has disabled public write access.
The following user(s) said Thank You: BeTa, JBeckman, Viper_Joe

New Contrast Adaptive Sharpening from AMD 1 week 1 day ago #2

Hmm interesting to see AMD already putting this up on their Github, though doesn't some of the sharpen effects for ReShade 3.0+ already have contrast adaptive support of some kind though it will be interesting to read more on how the effect here works even if that is the case. :)

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.
Last Edit: 1 week 1 day ago by JBeckman.
The administrator has disabled public write access.
The following user(s) said Thank You: BeTa

New Contrast Adaptive Sharpening from AMD 1 week 1 day ago #3

:P 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... :silly:
Last Edit: 1 week 1 day ago by BeTa.
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 1 day ago #4

Probably one by one port with CAS_BETTER_DIAGONALS, CAS_GO_SLOWER and noScaling
link: gist.github.com/SLSNe/bbaf2d77db0b2a2a0755df581b3cf00c
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 22 hours ago #5

BeTa wrote:
:P 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... :silly:
I've seen more complex shaders. But if anyone can port this, Marty can :) @MartyMcFly
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 19 hours ago #6

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 :P

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
Last Edit: 1 week 19 hours ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick, BeTa, jas01, Qsimil, Ryukou36, Viper_Joe

New Contrast Adaptive Sharpening from AMD 1 week 18 hours ago #7

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 :P

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? :cheer:

Anyway that CAS shader looks great, thanks :) works fine in Division 2 DX12.
<-MB-> ASROCK B450M Pro4 | <-CPU-> AMD Ryzen 2600 | <-RAM-> 16GB (2x8) DDR4 Kingston HyperX Predator 3200Mhz CAS16
<-SSD-> 120GB Kingston HyperX Fury + 512GB Adata XPG SX8200 Pro
<-GPU-> Sapphire Radeon RX580 NITRO+ 8GB | 23.8" LCD Acer SA240YA
Last Edit: 1 week 18 hours ago by Qsimil.
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 15 hours ago #8

:ohmy: :woohoo: :kiss: McFly !!!!!!! U Sir, are a Genius...

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..

:silly:
Last Edit: 1 week 14 hours ago by BeTa.
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 11 hours ago #9

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 :P

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
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.
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 9 hours ago #10

:ohmy: someone else also made an shader at Reddit.

--> 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?
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 1 week 9 hours ago #11

That's mine, I just did the bare minimum to get AMDs code working inside ReShade. It can probably be done better.
The administrator has disabled public write access.
The following user(s) said Thank You: BeTa

New Contrast Adaptive Sharpening from AMD 1 week 1 hour ago #12

That's actually the better way to do it, just like SMAA you're usually supposed to keep the header intact and just load it and give it the data it needs so this is probably the most faithful version. I'll check the assembly out of curiosity later.

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).
Last Edit: 1 week ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: BeTa, jas01, Viper_Joe, PureEvilWindom, aaronth07, colesdav

New Contrast Adaptive Sharpening from AMD 4 days 17 hours ago #13

A bit off topic, but you said that you ported HBAO+? Is it the same quality as HBAO+ if it was implemented in-game? And how does it compare to MXAO?
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 4 days 10 hours ago #14

He said, but he can't share it due to reshade license issue, even if you are patreon (that's how I understand it, because he didn't reply to my question) ;)
<-MB-> ASROCK B450M Pro4 | <-CPU-> AMD Ryzen 2600 | <-RAM-> 16GB (2x8) DDR4 Kingston HyperX Predator 3200Mhz CAS16
<-SSD-> 120GB Kingston HyperX Fury + 512GB Adata XPG SX8200 Pro
<-GPU-> Sapphire Radeon RX580 NITRO+ 8GB | 23.8" LCD Acer SA240YA
The administrator has disabled public write access.

New Contrast Adaptive Sharpening from AMD 3 days 17 hours ago #15

Correct, I ported HBAO+ - I even posted screenshots at some point. And yes, I cannot share it to anyone due to its license. It's obvious that I used it as a metric to compare MXAO to it, and it's also obvious that I learned a lot from it. Everyone rates HBAO+ and SSDO very highly but HBAO+ is 2012 tech, SSDO even 2006, everyone learned and improved from them. GTAO (2017 I believe) is superior to every existing screen-space AO tech apart from brute force far field methods, HBAO isn't even close. MXAO non HQ uses the same AO estimator as HBAO+ (which was originally Alchemy SAO), but superior sampling pattern, hence it's easier to filter and requires fewer samples. MXAO HQ is basically GTAO straight after paper, again with optimized sampling and a few other things.
Last Edit: 3 days 17 hours ago by Marty McFly.
The administrator has disabled public write access.
The following user(s) said Thank You: colesdav

New Contrast Adaptive Sharpening from AMD 3 days 9 hours ago #16

Hi, Just wanted to say thanks.

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.
The administrator has disabled public write access.