Hacker/Coding/Matrix Surface

Very simple shader to achieve a hacking/programming/matrix feel. Very easy to use.

1. Create new ShaderMaterial

2. Load this code as shader

And you’re ready to go!

 

If you don’t want shadows, remove depth_prepass_alpha from the render modes.

Shader code
shader_type spatial;

render_mode unshaded, depth_prepass_alpha;

void fragment() {
	ALBEDO.rb = vec2(0.0);
	ALBEDO.g = 1.0;
	float mask1 = sin((UV.y - TIME) * 4.0) * 0.2 + 0.6;
	float mask2 = sin((SCREEN_UV.x - TIME) * 30.0) * 0.2 + 0.8;
	float scanlines_factor = pow((sin((SCREEN_UV.y - TIME / 15.0) * 150.0) * 0.5 + 0.5), 2.5) * mask1 * mask2;

	float fresnel_factor = pow((1.0 - dot(VIEW, NORMAL)), 5);

	ALPHA = pow(scanlines_factor + fresnel_factor, 0.9);
}
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.

Related shaders

guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Ninjakrom
4 months ago
  1. 
tarnished_moth
tarnished_moth
3 months ago

I adapted this for use with 2D!

shader_type canvas_item;

void fragment() {
    COLOR.rb = vec2(0.0);
    COLOR.g = 1.0;
    float mask1 = sin((UV.y - TIME) * 4.0) * 0.2 + 0.6;
    float mask2 = sin((SCREEN_UV.x - TIME) * 30.0) * 0.2 + 0.8;
    float scanlines_factor = pow((sin((SCREEN_UV.y - TIME / 15.0) * 150.0) * 0.5 + 0.5), 2.5) * mask1 * mask2;

    float fresnel_factor = pow(0.0, 5);
    
    COLOR.a *= pow(scanlines_factor + fresnel_factor, 0.9);
}