speedin-santa/ring.gdshader
2024-12-18 16:35:26 -05:00

28 lines
717 B
Plaintext

shader_type spatial;
uniform sampler2D noise;
uniform vec3 color = vec3(0.98, 0.73, 0.23);
uniform vec3 color2 = vec3(1, 0, 0);
uniform float noiseScale = 20.0;
uniform float timeScale = 5.0;
uniform vec3 bobDirection = vec3(0, 0, 1);
uniform float bobStrength = 0.2;
uniform float bobSpeed = 1;
void vertex() {
VERTEX += bobStrength * sin(TIME * bobSpeed) * bobDirection;
}
void fragment() {
float alph1 = texture(noise, noiseScale * UV + TIME * timeScale).x;
float alph2 = texture(noise, noiseScale * UV + TIME * timeScale + vec2(0.2, 0.2)).x;
if (alph1 >= alph2){
ALBEDO = color;
EMISSION = color;
}else{
ALBEDO = color2;
EMISSION = color2;
}
ALPHA = clamp(3.0 * distance(alph1, alph2), 0, 1);
}