shader_type spatial; render_mode unshaded; global uniform float time; const int SCRIBBLES = 4; uniform sampler2D albedo_texture; uniform float scribble_switch_speed = 3.0; uniform float scribble_intensity = 0.05; group_uniforms ScribbleTextures; uniform sampler2D scribbles_1 : hint_normal; uniform sampler2D scribbles_2 : hint_normal; uniform sampler2D scribbles_3 : hint_normal; uniform sampler2D scribbles_4 : hint_normal; uniform sampler2D scribbles_1_1 : hint_normal; uniform sampler2D scribbles_2_2 : hint_normal; uniform sampler2D scribbles_3_3 : hint_normal; uniform sampler2D scribbles_4_4 : hint_normal; void vertex() { // Called for every vertex the material is visible on. } void fragment() { // Called for every pixel the material is visible on. //float duration = scribble_switch_speed * float(SCRIBBLES); float wrapped_time = mod(time * scribble_switch_speed, float(SCRIBBLES)); vec2 uv = UV; vec3 scribbles; switch (int(wrapped_time)) { case 0: scribbles = texture(scribbles_1, UV).rgb; break; case 1: scribbles = texture(scribbles_2, UV).rgb; break; case 2: scribbles = texture(scribbles_3, UV).rgb; break; case 3: scribbles = texture(scribbles_4, UV).rgb; break; } uv.x += (scribbles.x - 0.5) * scribble_intensity; uv.y += (scribbles.y - 0.5) * scribble_intensity; vec4 albedo = texture(albedo_texture, uv).rgba; ALBEDO = albedo.rgb; //ALBEDO = scribbles.rgb; ALPHA = albedo.a; } //void light() { // // Called for every pixel for every light affecting the material. // // Uncomment to replace the default light processing function with this one. //}