Skip to content

Instantly share code, notes, and snippets.

@hathibelagal-dev
Created March 10, 2025 10:44
Show Gist options
  • Save hathibelagal-dev/bf83ddd04566ef54d107f4cd01687a67 to your computer and use it in GitHub Desktop.
Save hathibelagal-dev/bf83ddd04566ef54d107f4cd01687a67 to your computer and use it in GitHub Desktop.
Just a beautiful, aesthetic shader try to portray a turbulent ocean
vec3 hsv(float h, float s, float v) {
vec3 c = vec3(h * 6.0, s, v);
vec3 step = vec3(5.0, 3.0, 1.0);
vec3 rgb = clamp(abs(mod(c.x + step, 6.0) - 3.0) - 1.0, 0.0, 1.0);
rgb = rgb * rgb * (3.0 - 2.0 * rgb);
return v * mix(vec3(1.0), rgb, s);
}
void mainImage(out vec4 fragColor, in vec2 FC)
{
float i, e, R, s;
float t=iTime;
vec4 o = vec4(0.0);
vec3 q, p, d = vec3(FC.xy/iResolution.xy - vec2(.6, .5), .7);
for(q.zx -= 1.; i++ < 60.;) {
o.rgb += hsv(0.15 + sin(t * 0.5) * 0.1,
0.3 + cos(t) * 0.2,
min(e * s, 0.9 - e) / 30.);
s = 1.;
p = q += d * e * R * 0.08;
p = vec3(log2(R = length(p)) - t * 1.2,
exp(1.5 - p.z/R) + sin(t * 2.) * 0.3,
atan(p.y, p.x) + cos(t * 1.5 + R) * 0.4);
for(e = --p.y; s < 5e2; s += s) {
vec3 sp = sin(p.zxy * s + t) * 1.2 - 0.6;
vec3 cp = 1. - cos(p.yxz * s + t * 0.7);
e += sin(dot(sp, cp)) / (s * 0.8);
}
}
fragColor = o;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment