Static Overlay Shader

Modified version of the Static Overlay by jordancjb.

Changes:

  • Updated for Godot 4 to use uniform sampler2D screen_texture.
  • Removes cos() around TIME. Change is consistent across frames.
  • Adds contrast and multiplier shader arguments.
  • Makes noise additive instead of multiplicative.

Usage:

This works as a screen shader, and so can be applied to a ColorRect node that is filling the screen, any color, and drawn over your content (bottom of the scene tree).

The shader takes four arguments:

noise is a noise texture that can be customized as needed. Examples use FastNoiseLite with a frequency of 0.25 and a texture scaled to the half the size of the game resolution.

slow determines the rate at which the static changes over to time. Higher is slower.

multiplier determines the intensity the overal static.

contrast scales the white vs the blacks against each other.

Examples:

The settings in the cover image were multiplier to 0.75 and contrast to 4.0

The first screenshots includes a CRT shader.

Shader code
// Original by: Jordancjb (https://linktr.ee/jordancjb)

shader_type canvas_item;

uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;

//Noise Texture
uniform sampler2D noise;

//Settings
uniform float slow = 25.0;
uniform float multiplier = 0.5;
uniform float contrast = 2.0;

//Shader Code
void fragment() {
	vec4 noise_sample = texture(noise, texture(noise, UV).xy + mod(TIME, 1.0) / slow);
	noise_sample.rgb = pow(noise_sample.rgb, vec3(contrast));
	COLOR = texture(screen_texture, SCREEN_UV) + (noise_sample * multiplier);
}
Live Preview
Tags
Static
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 Maaack

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments