Project_2026-02-01_18-22-55
GLSL shader by scry · created 2026-02-02 · 10s loop · 4 passes
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. //1 degree
#define time iTime*2.*pi/30. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
return mat2(cos(a),sin(a),-sin(a),cos(a));
}
vec3 rgb2hsv(vec3 c){vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));vec4
q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); float d
= q.x - min(q.w, q.y);float e = 1.0e-10;return vec3(abs(q.z + (q.w -
q.y) / (6.0 * d + e)), d / (q.x + e), q.x);}vec3 hsv2rgb( vec3 c ) {
vec4 K = vec4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); vec3 p = abs( fract(
c.xxx + K.xyz ) * 6.0 - K.www); return c.z * mix( K.xxx, clamp( p -
K.xxx, 0.0, 1.0), c.y);}float bitm(vec2 uv,int c) {float h = 5.;float
w = 3.;int p = int(pow(2.,w)); float line1 = 9591.; uv = floor(vec2(
uv.x*w,uv.y*h))/vec2(w,w);float c1 = 0.;float cc = uv.x + uv.y*w; c1
= mod( floor( float(c) / exp2(ceil(cc*w-0.6))) ,2.); c1 *= step( 0.,
uv.x)*step(0.,uv.y);c1 *= step(0.,(-uv.x+0.99))*step(0.,(-uv.y+1.6));
return (c1);}vec3 slogo(vec2 uv, float ar_, float size) {size = 240./
size;uv.x = 1.-uv.x;vec2 px = vec2(1./3.,1./5.); float ls = 4.1;uv *=
240./5.25/size;ls += 2.;float ul = length(uv);ul = length(vec2(uv.x*
0.5,uv.y)-0.5);uv -= 0.4;uv.x *= ar*1.75;uv.y *= 1.04;int s = 29671;
int c = 29263;int r = 31469; int y = 23186; uv.x= 5.-uv.x; float b =
bitm(uv,s); uv.x -= 1./3.*4.; b += bitm( uv,c); uv.x -= 1./3.*4.;b +=
bitm(uv,r);uv.x -= 1./3.*4.;b += bitm(uv,y);float rr = step(0.,uv.x+
px.x*13.)*step(0.,uv.y+px.y)*step(0.,(-uv.x+px.x*4.))*step(0.,(-uv.y
+px.y*6.));b = clamp(b,0.,1.);vec3 l = hsv2rgb(vec3(b+iTime/40.,0.1,
rr-b*1.9))*rr; l -= 0.1-clamp(ul*0.1, rr*1.-b,0.1); return vec3(l.x,
clamp(l.x,0.,1.)-l.x,clamp(-l.x,0.,1.));}
float hash(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}
float noise(vec2 p) {
vec2 i = floor(p); vec2 f = fract(p); f = f * f * (3.0 - 2.0 * f);
return mix(mix(hash(i), hash(i + vec2(1, 0)), f.x), mix(hash(i + vec2(0, 1)), hash(i + vec2(1, 1)), f.x), f.y);
}
float fbm(vec2 p) { float v = 0.0, a = 0.5; for(int i = 0; i < 5; i++) { v += a * noise(p); p *= 2.0; a *= 0.5; } return v; }
Buffer A (iChannel0)
vec3 getBackground(vec2 uv, float it) {
vec2 tv = uv;
vec3 b = texture(iChannel2, tv).rgb;
tv -= 0.5;
vec2 f = (fbm(tv * 20.) * pi * 20.+it) + b.xy;
//tv *= r2d(deg*sin(time+length(tv)*0.+sin(it*20.)*0.3));
tv += vec2(sin(f.x), cos(f.y)) * ((0.3 - (b.x + b.y)) / R);
tv += 0.5;
tv = fract(tv);
b = texture(iChannel0, tv).rgb;
tv -= 0.5;
f = (fbm(tv * 4. + time) * pi * 2.) + b.xy;
tv += vec2(sin(f.x), cos(f.y)) * (2. / R);
tv += 0.5;
b = texture(iChannel0, tv).rgb;
b = rgb2hsv(b);
b.r *= 1.02;
b.g *= 1.002;
b.r += texture(iChannel2,tv).z*0.01;
//b.z = texture(iChannel2,tv).z;
b = hsv2rgb(b);
vec3 fi = sin(cs + it*-5.5 + sin(sin(tv.x * 30. + time * 4.) * 2. + time * 4.) * 1. + 1.5) * 0.5 + 0.5;
//fi = rgb2hsv(fi);
return mix(b, fi, 1. - clamp(tv.y + 0.95, 0.99, 1.));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
vec4 rmData = texture(iChannel2, uv);
float depth = rmData.b;
float it = rmData.x * 100.;
bool hit = rmData.g > 0.5;
vec3 col = getBackground(uv, it);
if (iFrame < 2) {
vec2 tuv = uv - 0.5;
tuv.x *= ar;
col = vec3(1.)*fbm(uv*20.)*vec3(sin(fbm(uv*10.)*20.+cs)*0.5+0.5);
}
col = rgb2hsv(col);
col.x += rmData.z*0.01;//texture(iChannel2,uv).y*0.01;
col.z = mix(col.z,1.-rmData.z*0.7,0.02);
col.z -= 0.;
col = hsv2rgb(col);
col = clamp(col,0.,1.);
fragColor = vec4(col, 1.0);
}
Buffer B (iChannel1)
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
vec3 col = vec3(uv, 0.5 + 0.5*sin(iTime));
col.rg = sin(texture(iChannel0, uv).rg*pi*2.)*0.5+0.5;
fragColor = vec4(col, 1.0);
}
Buffer C (iChannel2)
float sdBox(vec3 p, vec3 b) {
vec3 q = abs(p) - b;
return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
}
float map(vec3 p, vec3 ro) {
vec3 o = p-ro;
float ps = 10.;
p = fract(p/ps-0.5)-0.5;
p *= ps;
float d = sdBox(p, vec3(0.5));
float s = 1.;
for (int i=0;i<9;i++) {
p.xz *= r2d(deg*-45.);
p.xz = abs(p.xz)-s;
p.xz *= r2d(deg*45.);
p.xy = abs(p.xy)-s;
p.xy *= r2d(deg*45.);
s *= 0.275;
d = min(d,sdBox(p,vec3(s)));
p.xz *= r2d(deg*90.);
}
d = max(d,-length(o)+0.3);
return d;
}
vec3 calcNormal(vec3 p, vec3 ro) {
vec2 e = vec2(0.001, 0.0);
return normalize(vec3(
map(p + e.xyy, ro) - map(p - e.xyy, ro),
map(p + e.yxy, ro) - map(p - e.yxy, ro),
map(p + e.yyx, ro) - map(p - e.yyx, ro)
));
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
uv -= 0.5;
uv.x *= ar;
vec3 ro = vec3(cos(time * 0.5) * 2.5, sin(time * 0.3) * 1.5, sin(time * 0.5) * 2.5);
ro *= 1.14+sin(time)*0.5;
vec3 ta = vec3(0.);
vec3 ww = normalize(ta - ro);
vec3 uu = normalize(cross(ww, vec3(0., 1., 0.)));
vec3 vv = cross(uu, ww);
vec3 rd = normalize(uv.x * uu + uv.y * vv + 0.3 * ww);
vec3 p = ro;
float t = 0.;
float it = 0.;
bool hit = false;
for(int i = 0; i < 64; i++) {
float d = map(p,ro);
if(d < 0.001) { hit = true; break; }
if(t > 20.) break;
t += d;
it += 0.1;
p = ro + rd * t;
}
float totalDepth = t;
float reflDepth = 0.;
const int MAX_BOUNCES = 9;
if(hit) {
for(int bounce = 0; bounce < MAX_BOUNCES; bounce++) {
vec3 n = calcNormal(p, ro);
vec3 refl = reflect(rd, n);
vec3 rp = p + n * 0.01;
float rt = 0.;
bool rhit = false;
for(int i = 0; i < 32; i++) {
float d = map(rp,ro);
if(d < 0.001) { rhit = true; break; }
if(rt > 20.) break;
rt += d;
rp = p + refl * rt;
}
totalDepth += rt;
if(rhit) {
p = rp;
rd = refl;
reflDepth += rt;
if(bounce == MAX_BOUNCES - 1) {
break;
}
} else {
break;
}
}
}
// r: iteration count (normalized)
// g: hit flag
// b: primary depth
vec3 oc = vec3(it / 100., hit ? 1. : 0., t / 20.);
//oc = oc.zzz;
fragColor = vec4(oc, 1.0);
}
Image
Not used
More shaders by scry
- Project_2026-08-15_18-22-06
- Project_2026-08-14_16-45-00
- Project_2026-07-24_15-10-23
- Project_2026-07-15_03-18-26
- Glass of Orange Juice (raymarched)
- Project_2026-07-13_00-53-50
- Project_2026-07-10_16-39-54
- Popcorn ceiling
- Project_2026-06-20_15-32-19
- Project_2026-06-25_12-22-43
- Visual Enhancer
- Project_2026-06-24_11-11-39
Browse all public shaders · All shaders by scry · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.