#GLSL: Animated 2D fluid inside sphere.
Use for loading animations, health UI, etc...
void mainImage(out vec4 col, in vec2 uv)
{
vec3 r = iResolution;
uv=((2.*uv)-r.xy)/r.y;
float
sdf=length(uv),c=step(sdf,.85),
vB=smoothstep(.1,.9,sin(uv.x+(PI*.5))-.3),
vBA=vB*sin(iTime*4.)*.1,
fW=(sin(((iTime*2.)+uv.x)*2.)*.05)+vBA,
bW=(sin(((iTime*-2.)+uv.x)*2.+PI)*.05)-vBA,
fA=(sin(iTime*4.)*.05)*vB,
fP=-.2+(sin((iTime)*PI)*.1),
fF=step(uv.y,(fA+fW)+fP)*c,
bF=step(uv.y,(-fA+bW)+fP)*c;
col =
vec4((step(sdf,1.)-step(sdf,.9))+
(fF+(clamp(bF-fF,0.,1.)*.8))+
clamp(pow((sdf+.01)*
((1.-(fF+bF))*c),5.),0.,1.));
}
Try it INTERACTIVE
w/ comments on #ShaderToy:
👉 shadertoy.com/view/Ds3BRN
#gamedev #indiedev #vfx #shader
float2 n,q,u=float2(i.uv-.5);
float d = dot(u,u),s=9,t=_Time.y,o,j;
for (float2x2 m=RM2D(5);j++<16;) {
u = mul(m,u);n = mul(m,n);
q = u*s+t*4+sin(t*4-d*6)*0.8+j+n;
o += dot(cos(q)/s, float2(2,2));
n -= sin(q);
s *= 1.2;
} return o;
#Unity3D #GLSL #VFXFriday
Oct 10, 2023 · 2:46 AM UTC
10
153
1,224
244,418
You can also try it live here.
twigl.app/?ol=true&ss=-NgMUO…
19
4,565







