Project_2026-01-31_11-06-23
GLSL shader by scry · created 2026-01-31 · 10s loop · 3 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)
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 d = sdBox(p, vec3(0.5));
float s = 1.;
//p.xz *= r2d(deg*45.);
//p.x = abs(p.x);
//p.xz *= r2d(deg*-45.);
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 *= r2d(deg*45.);
//p.xy = abs(p.xy)-s;
//p.xy *= r2d(deg*45.);
p.xy *= r2d(deg*45.+time);
p.xy = abs(p.xy)-s;
p.xy *= r2d(deg*45.);
//p.xz *= r2d(deg*45.);
//p.z = abs(p.z)-s*2.;
//p.xz *= r2d(deg*-45.);
//s *= (sin(time)*0.5+0.5)*0.5+0.25;
s *= 0.275;
//s *= 0.42;
//s *= 0.5+(sin(time)*0.5)*0.6;
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)
));
}
vec3 getBackground(vec2 uv, float it) {
vec2 tv = uv;
vec3 b = texture(iChannel1, tv).rgb;
tv -= 0.5;
vec2 f = (fbm(tv * 20.) * pi * 20.) + b.xy;
//f += it*2000.;
tv *= r2d(deg*sin(time+length(tv)*12.));
tv += vec2(sin(f.x), cos(f.y)) * ((0.3 - (b.x + b.y)) / R);
tv += 0.5;
tv = fract(tv);
//tv *= r2d(deg*1.);
b = texture(iChannel0, tv).rgb;
tv -= 0.5;
f = (fbm(tv * 4. + time) * pi * 2.) + b.xy;
//f -= it*14.;
tv += vec2(sin(f.x), cos(f.y)) * (2. / R);
tv += 0.5;
b = texture(iChannel0, tv).rgb;
//b= rgb2hsv(b);
//b.x += 0.01;
//b.z -= it*0.0001;
//b = hsv2rgb(b);
//b = mix(b,sin(it*4.+cs+time*8.)*0.5+0.5,it*it*0.002);
//b += sin(it)*0.01;
vec3 fi = sin(cs + it*-5.5 + sin(sin(tv.x * 30. + time * 4.) * 2. + time * 4.) * 1. + 1.5) * 0.5 + 0.5;
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;
vec2 tv = uv;
uv -= 0.5;
uv.x *= ar;
//uv *= 3.;
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;
}
vec3 col = vec3(0.);
//col += sin(t*20.);
const int MAX_BOUNCES = 9;
vec3 accum = vec3(0.);
vec3 mask = vec3(1.);
if(hit) {
for(int bounce = 0; bounce < MAX_BOUNCES; bounce++) {
vec3 n = calcNormal(p, ro);
vec3 refl = reflect(rd, n);
float fresnel = pow(1. - max(dot(-rd, n), 0.), 3.);
// March reflection ray
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;
}
if(rhit) {
p = rp;
rd = refl;
// If we've bounced too many times, sample background
if(bounce == MAX_BOUNCES - 1) {
vec2 reflUV = vec2(atan(refl.z, refl.x) / (2. * pi) + 0.5, asin(refl.y) / pi + 0.5);
col = getBackground((reflUV-0.5)*2.75,it);
}
} else {
vec2 reflUV = vec2(atan(refl.z, refl.x) / (2. * pi) + 0.5, asin(refl.y) / pi + 0.5);
vec3 reflCol = getBackground((reflUV-0.5)*2.75,it);
reflCol = rgb2hsv(reflCol);
reflCol.x -= -0.2;
reflCol.z -= 0.1;
reflCol = hsv2rgb(reflCol);
reflCol = pow(reflCol, vec3(1.1)) * 1.2;
col = mix(vec3(0.1), reflCol, 0.7 + fresnel * 0.3);
col += (sin(it+cs)*1.+0.5)*0.4;
break;
}
}
} else {
col = getBackground(tv,it);
}
//col += t;
if (iFrame < 2) {
col = vec3(1.)*fbm(uv*20.)*vec3(sin(fbm(uv*10.)*20.+cs)*0.5+0.5);
}
//col *= 1.01;
//col -= 0.006;
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);
}
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.