Simple Grain

More
2 years 6 months ago - 2 years 6 months ago #1 by Fu-Bama
Simple Grain was created by Fu-Bama
I recently made simple film grain filter as the default one dropped for me like 10FPS in every game.
Minor thing; this one affects black areas. I think it's more realistic that way.
Also, it has limiter for noise seed value, to assure the ting won't Go Skrrrraaa after longer period of playing. ;P



Shader Code:
Warning: Spoiler!
Last edit: 2 years 6 months ago by Fu-Bama.
The following user(s) said Thank You: Wicked Sick

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago - 2 years 6 months ago #2 by lowenz
Replied by lowenz on topic Simple Grain
Black Areas? Do you mean in a letterboxed frame?
Last edit: 2 years 6 months ago by lowenz.

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago - 2 years 6 months ago #3 by Fu-Bama
Replied by Fu-Bama on topic Simple Grain

lowenz wrote: Black Areas? Do you mean in a letterboxed frame?

:lol: No, black areas like shadows, black pixels. The default one applies noise 0-black, 1-gray, 0-white pixels.
This one has 1.62 gamma curve, so it's like 1-black, 0.33≈gray, 0-white.

On the picture right side you have white lamp, some medium cans and shadow in the background under the ladder, also there is pure black letterbox with noise applied.
Last edit: 2 years 6 months ago by Fu-Bama.

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #4 by UTwelve
Replied by UTwelve on topic Simple Grain
I like this ! :woohoo:
Can be calculated according to the average brightness of the screen? Like a real camera AUTO ISO


example
Light: iso200
dark: iso6400
(Not rigorous)
——Google Translate :silly:

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #5 by Fu-Bama
Replied by Fu-Bama on topic Simple Grain

UTwelve wrote: Can be calculated according to the average brightness of the screen?

Very nice chart.
Yes it could, but digital camera ISO is not noise-value, but signal amplify amount.
Signal is amplified with higher ISO, but as things go, background noise is amplified too.

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago - 2 years 6 months ago #6 by UTwelve
Replied by UTwelve on topic Simple Grain
During the day(or average brightness),Because ‘auto iso’ ,iso about 100-200iso。
black pixels should be no grain。just black
Last edit: 2 years 6 months ago by UTwelve.

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #7 by brussell
Replied by brussell on topic Simple Grain
Try to add this code for grain depending on average screen luminance.
texture2D texLuminance { Width = 256; Height = 256; Format = R8; MipLevels = 7; };
sampler SamplerLuminance { Texture = texLuminance; };

float PS_Luminance(float4 pos : SV_Position, float2 texcoord : TEXCOORD) : SV_Target
{
   return dot(tex2D(ReShade::BackBuffer, texcoord.xy).xyz, 0.333);
}

void SimpleGrainPS(float4 vois : SV_Position, float2 TexCoord : TEXCOORD, out float3 Image : SV_Target)
{
...
float avglum = tex2Dlod(SamplerLuminance, float4(0.5.xx, 0, 7)).x;
Noise *= (1-avglum);
...
}

technique SimpleGrain {
    pass
    {
        VertexShader = PostProcessVS;
        PixelShader = PS_Luminance;
        RenderTarget = texLuminance;
    }
    pass
    {
	VertexShader = PostProcessVS;
	PixelShader = SimpleGrainPS;
    }
}

Please Log in or Create an account to join the conversation.

More
2 years 6 months ago #8 by UTwelve
Replied by UTwelve on topic Simple Grain
Good use

Please Log in or Create an account to join the conversation.

More
2 years 5 months ago #9 by BONKERS
Replied by BONKERS on topic Simple Grain
Really liked using this shader. Here are a few phone wallpapers I made from screenshots of RE7 using this.
abload.de/img/re7b2pwu4l.jpg
abload.de/img/re7b4ogum1.jpg
abload.de/img/re7b5npusb.jpg

Please Log in or Create an account to join the conversation.

More
2 years 4 months ago #10 by Wicked Sick
Replied by Wicked Sick on topic Simple Grain
I really liked this shader. I hope to see it in the repository too.

Please Log in or Create an account to join the conversation.

More
2 years 4 months ago #11 by BONKERS
Replied by BONKERS on topic Simple Grain
One thing I really don't like about this shader though, in order to get a really decently noticeable effect running at same framerate as the game. You have to turn it up a bit. But then it really becomes noticeable that the grain shader affects the luminosity on the lower end of the image and causes it to lose a little bit of contrast and appear just slightly washed out.
Easily visible when turning it off A/B.

Please Log in or Create an account to join the conversation.