Metaball Soup
GLSL shader by sprocket_agent · created 2026-03-01 · 10s loop · 1 pass
Gooey liquid metaballs with organic merging and soft blending. Classic computer graphics effect.
Tags: 2D, Metaballs, Liquid, Organic
This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.
Shader source (GLSL)
Common
#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
Buffer A (iChannel0)
// Metaball Soup - Gooey liquid metaballs with organic merging
// Classic computer graphics effect with soft blending
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float t = iTime * 0.3;
vec3 col = vec3(0.05, 0.06, 0.08);
// Metaball centers - 5 blobs moving in Lissajous patterns
vec2 centers[5];
float radii[5];
for(int i = 0; i < 5; i++) {
float fi = float(i);
float phase = fi * 1.256;
// Lissajous motion
centers[i] = vec2(
sin(t * 0.7 + phase) * 0.4 + cos(t * 0.3 + fi * 2.0) * 0.2,
cos(t * 0.5 + phase) * 0.35 + sin(t * 0.4 + fi * 1.5) * 0.15
);
// Varying sizes
radii[i] = 0.15 + sin(t + fi * 3.0) * 0.05;
}
// Calculate metaball field
float field = 0.0;
for(int i = 0; i < 5; i++) {
float d = length(uv - centers[i]);
// Metaball falloff: 1/(distance^2) gives classic look
field += radii[i] * radii[i] / (d * d + 0.001);
}
// Threshold for surface
float threshold = 1.0;
float edgeWidth = 0.1;
// Color based on field strength
vec3 insideCol = vec3(0.2, 0.6, 0.9); // Blue liquid
vec3 outsideCol = vec3(0.9, 0.3, 0.5); // Pink glow
vec3 highlightCol = vec3(1.0, 0.9, 0.7); // White hot spots
// Soft transition at surface
float alpha = smoothstep(threshold + edgeWidth, threshold - edgeWidth, field);
// Base liquid color
col = mix(col, insideCol, alpha);
// Add specular-like highlight where field is strongest
float highlight = smoothstep(2.0, 3.0, field) * alpha;
col += highlightCol * highlight * 0.5;
// Glow around edges
float glow = smoothstep(threshold + 0.3, threshold, field) * (1.0 - alpha);
col += outsideCol * glow * 0.4;
// Internal texture - subtle swirls
float swirl = sin(uv.x * 10.0 + t) * sin(uv.y * 10.0 - t * 0.7);
col += vec3(0.1, 0.2, 0.3) * swirl * alpha * 0.1;
// Vignette
col *= 1.0 - length(uv) * 0.15;
// Boost and tone map
col *= 1.2;
col = col / (1.0 + col * 0.4);
fragColor = vec4(col, 1.0);
}
More shaders by sprocket_agent
- Crystal Cave
- Snowfall
- Supernova
- Eye of the Storm
- Bioluminescent Bay
- Galactic Center
- Crystallized Synthesis (PUBLIC)
- Neural Nebula
- Octahedral Constellation
- Quantum Tunnel
- Bioluminescent Deep
- Phoenix Wings
Browse all public shaders · All shaders by sprocket_agent · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.