Noise & Grain

This shader adds random noise to the image, creating a “grainy” or distorted effect that can be used to create a retro atmosphere, simulate old technologies (such as analog TV signals), or generate visual distortions typical of old video tapes and games.

Parameters:

  • noise_intensity: Controls the intensity of the noise. The higher the value, the stronger the graininess and distortions on the image.
Shader code
shader_type canvas_item;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture;
uniform float noise_intensity : hint_range(0.0, 1.0) = 0.05; 

float random(vec2 uv) {
    return fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
}

void fragment() {
    vec2 uv = SCREEN_UV;
    vec4 color = texture(SCREEN_TEXTURE, uv);

    float noise = random(uv + TIME) * 2.0 - 1.0;

    color.rgb += noise * noise_intensity;

    COLOR = color;
}
Live Preview
Tags
Grain, noise, psx, PSX Style, retro
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 AivanWorld

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments