Noise Laser

Simple shader that shows a laser around a line based on a noise.

The line shoud be at the center of the sprite, vertically (rotate the whole sprite if needed).

See the gif posted above to have an idea of it running…

Shader code
shader_type canvas_item;

uniform float strength = 4.0;
uniform sampler2D noise;

void fragment() {
	COLOR = texture(TEXTURE,UV);
	float noise_value = texture( noise, vec2(fract(TIME), UV.y) ).r;
	if (COLOR.a == 0.0) {
		float dist_to_mid = abs(UV.x - 0.5) * 2.0;
		COLOR = vec4(1.0, 1.0, 1.0, strength * noise_value * (1.0 - dist_to_mid) * (1.0 - dist_to_mid) );
	}
}
Tags
laser line noise
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 atn

Pixel art trail

Related shaders

Noise vertex displacement

Screen Noise Effect Shader

guest
0 Comments
Inline Feedbacks
View all comments