Welcome, Guest.
Username: Password: Remember me

TOPIC: Problem with an old SweetFX Grain shader

Problem with an old SweetFX Grain shader 7 months 1 week ago #1

Hi there, I realize this may not be appropriate since it's not strictly Reshade related but I am pretty desperate for help.

So I am very fond of Boulotaur2024's custom injector for SweetFX he made several years ago
forums.guru3d.com/threads/sweetfx-shader...page-27#post-4581604
xp-dev.com/sc/174865/HEAD/%2Fd3d9DLL
Because of one thing, the film grain shader that he ported from Jorge Jimenez's SSS demo on github to DX10/11 and DX9.
When paired with a custom grain texture it looks gorgeous imo and blends really well. And it really works well in easing distraction from compression artifacts in FMVs.

The only problem is, after the shader has been running for approximately 30 minutes the output turns into garbage
This happens with Jorge's original texture, and several custom textures i've tried.

Default abload.de/img/rerev_2018_01_04_18_4lgs1y.png (Exaggerated for effect so it's more visible)
After about 30 minutes abload.de/img/rerev_2018_01_04_20_2rzsb2.png

I played through a few games over the last few years with this, dealing with the problem and restarting the game after it starts to annoy me.
abload.de/img/222480_20180101233614pvslk.png
abload.de/img/222480_20180103001331qtsnk.png
Examples when set up and working

So i'm just curious if anyone can look at the shader code here and could think of any reason that might jump out at you as to why this happens.
Warning: Spoiler! [ Click to expand ]


In the source repository linked above there is some files for the grain shader which isn't visible in the sweetFX shader visible to the user. So I don't know if that points to anything either.

If anyone could take a glance and offer any ideas, that'd be stupendous. Thanks a lot.

I haven't tried Reshade's grain in a while but last I recall it didn't work correctly. I do remember using the grain in the 1.0/2.0 releases that was ported from the Grain shader in GeDoSaTo and enjoying that quite a bit. (Which is my next favorite to use). But the real reason I don't want to use Reshade is because I prefer to force AA at the driver level (I manage the HBAO+/AA threads on Guru3D forums.guru3d.com/forums/videocards-nvid...-drivers-section.21/), and all I really need is some basic sharpening most of the time after AA. The other reason is that ReShade 3 interferes with forcing AA (Likely due to surface formats), often requiring extra compatibility to work and it also can alter the efficacy of shaders and also can catastrophically drop performance when forcing AA.


Or Perhaps would anyone be able to port this shader to reshade as is, and test to see if it does the same thing??
Last Edit: 7 months 1 week ago by BONKERS.
The administrator has disabled public write access.

Problem with an old SweetFX Grain shader 5 months 2 weeks ago #2

I think the degradation over time has something to do with random number generator, where the seed is the frame number.
When there's no sine in the random function or seed exceeds certain number, some glitch happens.

I recently made film grain fx as the ReShade default dropped for me 10FPS in every game. Maybe you can try this one and see if you like it:
Warning: Spoiler! [ Click to expand ]


EDIT*
I posted the updated version in presentation topics reshade.me/forum/shader-presentation/4035-simple-grain
Last Edit: 5 months 2 weeks ago by Fu-Bama.
The administrator has disabled public write access.
The following user(s) said Thank You: sajittarius

Problem with an old SweetFX Grain shader 5 months 2 weeks ago #3

One can fix such RNG's that degrade with high timer values by just lowering the value periodically by timervalue mod largevalue.
Fu-Bama: is there a special reason for the golden ratio in the mask or not?

Also: float Luma(float3 Source, float3 Coefficients) {return dot(Source, Coefficients);}
Last Edit: 5 months 2 weeks ago by Marty McFly.
The administrator has disabled public write access.

Problem with an old SweetFX Grain shader 5 months 2 weeks ago #4

I've set the noise mask to inverted luminance value, but there was too much noise in the gray areas. So I played with some values to get sweet spot. 2 was too big, 1.5 too small. Something around 1.6 gamma was alright so I went with golden ratio.
And thanks for the mod and dot function. :)
Last Edit: 5 months 2 weeks ago by Fu-Bama.
The administrator has disabled public write access.

Problem with an old SweetFX Grain shader 5 months 2 weeks ago #5

Marty McFly wrote:
(...) by just lowering the value periodically by timervalue mod largevalue. (...)
I tested it out and it creates periodic flashing of no-noise.
Simulated 8h gameplay by adding 1728000 to the FrameCount.

*EDIT
I found something that works.
Seed = frac(Seed * 0.0001) * 10000;
Last Edit: 5 months 2 weeks ago by Fu-Bama. Reason: added solution
The administrator has disabled public write access.

Problem with an old SweetFX Grain shader 5 months 5 days ago #6

Ah, I will try that shader. Thanks for the replies.

That simple grain shader is pretty nice for the performance. Seems pretty similar the one I posted above looks wise.
Though the old one used to have the effect of slightly changing the exposure of the whites. I think this was influenced by the noise texture used however. As the texture I made for it was different than the default and I don't think that one did the same.

I will probably use this in the future in addition to the other ReShade Grain shaders. (I still keep an old version of Reshade around that has the properly working GrainShader ported from GeDoSaTo. As I like that one too. But performance is a bit costlier.)
Last Edit: 5 months 5 days ago by BONKERS.
The administrator has disabled public write access.