Welcome, Guest.
Username: Password: Remember me

TOPIC: Simple Grain

Simple Grain 6 months 3 weeks ago #1

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! [ Click to expand ]
Last Edit: 6 months 3 weeks ago by Fu-Bama.
The administrator has disabled public write access.
The following user(s) said Thank You: Wicked Sick

Simple Grain 6 months 3 weeks ago #2

Black Areas? Do you mean in a letterboxed frame?
Last Edit: 6 months 3 weeks ago by lowenz.
The administrator has disabled public write access.

Simple Grain 6 months 3 weeks ago #3

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: 6 months 3 weeks ago by Fu-Bama.
The administrator has disabled public write access.

Simple Grain 6 months 2 weeks ago #4

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

Simple Grain 6 months 2 weeks ago #5

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

Simple Grain 6 months 2 weeks ago #6

During the day(or average brightness),Because ‘auto iso’ ,iso about 100-200iso。
black pixels should be no grain。just black
Last Edit: 6 months 2 weeks ago by UTwelve.
The administrator has disabled public write access.

Simple Grain 6 months 2 weeks ago #7

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

Simple Grain 6 months 2 weeks ago #8

Good use
The administrator has disabled public write access.

Simple Grain 5 months 1 day ago #9

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

Simple Grain 4 months 1 week ago #10

  • Wicked Sick
  • Wicked Sick's Avatar
  • Offline
  • Die young or suffer (Forgive my poor English)
I really liked this shader. I hope to see it in the repository too.
Finding relief somewhere between a tree's branch and its shade.
The administrator has disabled public write access.

Simple Grain 4 months 1 week ago #11

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