Godot glitch art.


//color_spikes.gdshader
//flash warning btw
shader_type spatial;
uniform float scale : hint_range(0.05, 1.0) = 1;

// Called for every vertex the material is visible on.
void vertex() {
	vec3 vert = VERTEX;
	int id = VERTEX_ID;
	COLOR = vec4(0,0,0,1);
	//offset every 51st vertex and color them red
	//change the chosen vertices over time
	if (id % 51 == int(TIME*22.0)%51){
		vert = vert + vec3(1,5,1) * scale;
		COLOR.r = 1.0;
	}
	//all these numbers were chosen arbitrarily
	if (id % 24 == int(TIME*16.0)%24){
		//but i made the offset vectors sort of perpendicular
		vert = vert + vec3(4,0,-1) * scale;
		COLOR.g = 1.0;
	}
	if (id % 76 == int(TIME*12.0)%76){
		vert = vert + vec3(-4,0,-5) * scale;
		COLOR.b = 1.0;
	}
	VERTEX = vert;
}

// Called for every pixel the material is visible on.
void fragment() {
	//clip colors
	ALBEDO = vec3(0,0,0);
	if (COLOR.r > 0.1){
		ALBEDO.r = 1.0;
	}
	if (COLOR.g > 0.1){
		ALBEDO.g = 1.0;
	}
	if (COLOR.b > 0.1){
		ALBEDO.b = 1.0;
	}
	//gradient
	//ALBEDO = COLOR.xyz;
}