cirnogodot/Shaders/Acid.gdshader

34 lines
1.3 KiB
Text

shader_type spatial;
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;
// How fast the goo undulates — lower = lazier/thicker
uniform float speed = 0.4;
void fragment() {
vec2 uv = UV;
float t = TIME * speed;
// 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);
float noise_a = texture(noise_tex, noise_uv_a).r;
float noise_b = texture(noise_tex, noise_uv_b).r;
vec2 distortion = vec2(noise_a - 0.5, noise_b - 0.5) * distortion_strength;
vec4 tex_color = texture(albedo_tex, uv + distortion);
vec3 final_color = tex_color.rgb * acid_color.rgb;
// 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);
ALBEDO = final_color;
}