Grain (Old Movie)

Put it on a ColorRect. Adjust strength with Slider. 

# Changed hint range increment to 0.01 

Shader code
shader_type canvas_item;
// set max strength to your liking here=20.0, step_size=0.1
uniform float strength:hint_range(0, 20.0, 0.01)=16;

void fragment() {
	
	// Screen Color
    vec4 screen = texture(TEXTURE, SCREEN_UV);
	vec2 iResolution = 1.0 / SCREEN_PIXEL_SIZE;
	vec2 uv = FRAGCOORD.xy / iResolution.xy;
    
	// Random noise
    float x = (uv.x + 4.0 ) * (uv.y + 4.0 ) * (TIME * 10.0);
	// Add grain to Screen
	screen = screen+vec4(mod((mod(x, 13.0) ) * (mod(x, 123.0) ), 0.01)-0.005) * strength;
    
    screen = 1.0 - screen;
	COLOR = screen;
    
}
Live Preview
Tags
post-processing canvas
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from zuwiwano

Related shaders

guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
DevOct
2 years ago

THANK U SO MUCH!

DXB6
DXB6
2 years ago

You’re a lifesaver. I honestly don’t even know how the math behind this works, so I’m just going to consider it wizardry.