add noise shader to laser graphics

This commit is contained in:
Haze Weathers 2023-03-21 17:19:26 -04:00
parent 90cc0f0550
commit 5a9751946c
3 changed files with 51 additions and 2 deletions

View file

@ -0,0 +1,17 @@
shader_type canvas_item;
uniform bool animate_noise = false;
uniform float noise_intensity = 1.0;
float random (vec2 uv) {
return fract(sin(dot(uv.xy,
vec2(12.9898,78.233))) * 43758.5453123);
}
void fragment() {
vec2 noise_uv = SCREEN_UV + TIME * float(animate_noise);
float noise = random(noise_uv);
noise = mix(1.0 - noise_intensity, 1.0, noise);
COLOR = vec4(COLOR.rgb * noise, COLOR.a);
}