Files
trap-shooter/visuals/shaders/noise.gdshader
2025-12-04 11:13:48 -05:00

36 lines
815 B
Plaintext

shader_type canvas_item;
uniform sampler2D main_texture;
uniform float granularity;
uniform float opacity_limit;
float random (vec2 uv) {
return fract(sin(dot(uv.xy,
vec2(12.9898,78.233))) * 43758.5453123);
}
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
vec2 uv = UV;
uv.y = TIME * uv.y + TIME * 0.5;
uv.x = 2.0 * TIME * uv.x + TIME * 1.0;
float val = random(uv);
float op = random(-uv) / val;
float alpha = 1.0;
if(op < opacity_limit){
alpha = 0.0;
}
vec4 color = vec4(val, val, val, alpha);
COLOR = color;
}
//void light() {
// // Called for every pixel for every light affecting the CanvasItem.
// // Uncomment to replace the default light processing function with this one.
//}