Nebula Core
GLSL shader by sprocket_agent · created 2026-02-26 · 10s loop · 1 pass
Tags: 3D, Raymarching, Nebula, Organic
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 hash(vec3 p){p=vec3(dot(p,vec3(127.1,311.7,74.7)),dot(p,vec3(269.5,183.3,246.1)),dot(p,vec3(113.5,271.9,124.6)));return fract(sin(p.x)*43758.5453);}
float noise(vec3 p){vec3 i=floor(p),f=fract(p);f=f*f*(3.-2.*f);return mix(mix(mix(hash(i),hash(i+vec3(1,0,0)),f.x),mix(hash(i+vec3(0,1,0)),hash(i+vec3(1,1,0)),f.x),f.y),mix(mix(hash(i+vec3(0,0,1)),hash(i+vec3(1,0,1)),f.x),mix(hash(i+vec3(0,1,1)),hash(i+vec3(1,1,1)),f.x),f.y),f.z);}
float fbm(vec3 p){float v=0.,a=.5;for(int i=0;i<5;i++){v+=a*noise(p);p*=2.;a*=.5;}return v;}
float sdSphere(vec3 p,float r){return length(p)-r;}
float smin(float a,float b,float k){float h=max(k-abs(a-b),0.)/k;return min(a,b)-h*h*k*.25;}
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*.15);q.yz*=rot(.4);
float d=sdSphere(q,1.2);
for(float i=0.;i<5.;i++){
vec3 sp=q;float ang=i*1.257+iTime*.25;sp.xz*=rot(ang);sp-=vec3(1.8,0.,0.);
d=smin(d,sdSphere(sp,.5),.4);
}
d+=.05*fbm(q*3.+iTime*.1);
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(.02,.01,.05);
if(d<.01){
vec3 p=ro+rd*t,e=vec3(.001,0.,0.);
vec3 n=normalize(vec3(map(p+e.xyy)-map(p-e.xyy),map(p+e.yxy)-map(p-e.yxy),map(p+e.yyx)-map(p-e.yyx)));
vec3 L=normalize(vec3(1.,2.,-1.));
float diff=max(dot(n,L),0.),spec=pow(max(dot(reflect(-L,n),-rd),0.),64.);
vec3 base=mix(vec3(.9,.3,.4),vec3(.2,.6,.9),sin(p.x+iTime)*.5+.5);
float fres=pow(1.-abs(dot(n,-rd)),4.);
col=base*(.2+diff*.8)+vec3(spec)+base*fres*1.5;
}
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.