cirnogodot/Shaders/Acid.gdshader

34 lines
1.3 KiB
Text
Raw Permalink Normal View History

2026-03-01 19:14:34 +01:00
shader_type spatial;
2026-03-01 17:46:24 +01:00
render_mode unshaded, depth_draw_opaque, cull_back;
uniform sampler2D albedo_tex : source_color, filter_nearest, repeat_enable, hint_default_white;
uniform sampler2D noise_tex : hint_default_white, filter_linear_mipmap, repeat_enable;
uniform vec4 acid_color : source_color = vec4(0.2, 0.85, 0.1, 1.0);
uniform float distortion_strength = 0.04;
uniform float emission_energy = 0.4;
2026-03-01 18:00:54 +01:00
// How fast the goo undulates — lower = lazier/thicker
uniform float speed = 0.4;
2026-03-01 17:46:24 +01:00
void fragment() {
vec2 uv = UV;
2026-03-01 18:00:54 +01:00
float t = TIME * speed;
2026-03-01 17:46:24 +01:00
2026-03-01 18:00:54 +01:00
// Two noise layers scrolling in opposite diagonal directions.
// They fight each other so there's no net flow, just churning.
vec2 noise_uv_a = uv * 0.5 + vec2( t * 0.6, t * 0.4);
vec2 noise_uv_b = uv * 0.5 + vec2(-t * 0.5, -t * 0.7);
2026-03-01 17:46:24 +01:00
float noise_a = texture(noise_tex, noise_uv_a).r;
float noise_b = texture(noise_tex, noise_uv_b).r;
2026-03-01 18:00:54 +01:00
vec2 distortion = vec2(noise_a - 0.5, noise_b - 0.5) * distortion_strength;
2026-03-01 17:46:24 +01:00
2026-03-01 18:00:54 +01:00
vec4 tex_color = texture(albedo_tex, uv + distortion);
2026-03-01 17:46:24 +01:00
vec3 final_color = tex_color.rgb * acid_color.rgb;
2026-03-01 18:00:54 +01:00
// Slow breathing glow from a third noise layer
float breathe = texture(noise_tex, uv * 0.3 + vec2(t * 0.3, t * 0.2)).r;
final_color += final_color * emission_energy * (0.6 + 0.4 * breathe);
2026-03-01 17:46:24 +01:00
ALBEDO = final_color;
}