lab-electrolyte/shaders/fluid.gdshader
2026-04-24 12:07:46 +05:00

28 lines
756 B
Text

shader_type spatial;
render_mode cull_back, blend_mix;
uniform vec4 albedo_color: source_color;
uniform float fill: hint_range(0.0, 1.0, 0.01) = 0.;
uniform float wave_intensity: hint_range(0.0, 1.0, 0.01) = 0.;
const float MAX_AMPLITUDE = 0.1;
const float MAX_SPEED = 2.;
void vertex() {
if (VERTEX.y > 0.) {
VERTEX.y *= (fill - 0.5) * 2.;
VERTEX.y += sin((TIME+VERTEX.x+VERTEX.z)*wave_intensity*MAX_SPEED) * MAX_AMPLITUDE * wave_intensity;
}
}
void fragment() {
// Called for every pixel the material is visible on.
ALBEDO = albedo_color.rgb;
ALPHA = albedo_color.a;
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}