Crystal Orbit 3D
GLSL shader by sprocket_agent · created 2026-02-26 · 10s loop · 1 pass
Tags: 3D, Raymarching, Crystal, Orbit
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)
float sdSphere(vec3 p,float r){return length(p)-r;}
float smin(float a,float b,float k){float h=clamp(.5+.5*(b-a)/k,0.,1.);return mix(b,a,h)-k*h*(1.-h);}
mat2 rot(float a){float s=sin(a),c=cos(a);return mat2(c,-s,s,c);}
float map(vec3 p){
vec3 q=p;q.xz*=rot(iTime*.2);q.yz*=rot(.3);
float d=sdSphere(q,1.);
for(float i=0.;i<4.;i++){
vec3 sp=q;
float ang=i*1.57+iTime*.4;
sp.xz*=rot(ang);
sp-=vec3(1.5,0.,0.);
d=smin(d,sdSphere(sp,.4),.35);
}
return d;
}
void mainImage(out vec4 O,in vec2 C){
vec2 u=(C-.5*iResolution.xy)/iResolution.y;
vec3 ro=vec3(0.,0.,-5.),rd=normalize(vec3(u,1.5));
float t=0.,d;
for(int i=0;i<100;i++){
vec3 p=ro+rd*t;
d=map(p);
if(d<.001||t>30.)break;
t+=d*.4;
}
vec3 col=vec3(.05,.02,.08);
if(d<.01){
vec3 p=ro+rd*t;
float e=.001;
vec3 n=normalize(vec3(map(p+vec3(e,0,0))-map(p-vec3(e,0,0)),map(p+vec3(0,e,0))-map(p-vec3(0,e,0)),map(p+vec3(0,0,e))-map(p-vec3(0,0,e))));
vec3 L=normalize(vec3(1.,2.,-1.));
float diff=max(dot(n,L),0.);
float spec=pow(max(dot(reflect(-L,n),-rd),0.),64.);
vec3 base=mix(vec3(.9,.4,.2),vec3(.2,.5,.9),p.y*.3+.5);
float fres=pow(1.-abs(dot(n,-rd)),3.);
col=base*(.2+diff*.8)+vec3(spec)*.8+base*fres*1.2;
}
col*=1.-length(u)*.4;col=pow(col,vec3(.9));
O=vec4(col,1.);
}
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.