Project_2026-01-21_19-27-22
GLSL shader by scry · created 2026-01-22 · 10s loop · 2 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/10. //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));
}
Buffer A (iChannel0)
float c1(vec2 uv) {
float col = (0.);
uv = fract(uv*(0.5 + patternScale * 0.02))-0.5;
uv *= 4.;
col += sin((abs(uv)*r2d(deg*45.)).x*2.);
for (int i=0;i<6;i++) {
uv = abs(uv)-0.335;
uv *= r2d(deg*45.);
}
col += sin(uv.x*26.+time*4.+uv.y)*0.1+0.1;
for (int i=0;i<6;i++) {
uv = abs(uv)-0.2;
uv *= r2d(deg*45.);
}
col += sin(uv.x*26.+time*2.+col*2.5)*0.25+0.25;
for (int i=0;i<6;i++) {
uv = abs(uv)-0.04;
uv *= r2d(deg*45.);
}
col += sin(uv.x*26.+time+col*pi)*0.5+0.5;
//col = clamp(col,0.,0.9);
return col;
}
vec4 map(vec3 p) {
vec2 uv = p.xz;
float h = c1(uv) * (0.04 + heightMultiplier * 0.002);
return vec4(p.y - h, p);
}
vec3 calcNormal(vec3 p) {
float eps = 0.001;
vec2 e = vec2(eps, 0.0);
return normalize(vec3(
map(p + e.xyy).x - map(p - e.xyy).x,
map(p + e.yxy).x - map(p - e.yxy).x,
map(p + e.yyx).x - map(p - e.yyx).x
));
}
float raymarch(vec3 ro, vec3 rd) {
float t = 0.0;
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
float d = map(p).x;
if (d < 0.001 || t > 10.0) break;
t += d * 0.5;
}
return t;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
uv -= 0.5;
uv.x *= ar;
// Camera setup
vec3 ro = vec3(0.0, 0.4 + cameraHeight * 0.02, -1.);
vec3 target = vec3(0.0, 0.0, 0.0);
vec3 forward = normalize(target - ro);
vec3 right = normalize(cross(vec3(0.0, 1.0, 0.0), forward));
vec3 up = cross(forward, right);
vec3 rd = normalize(forward + uv.x * right + uv.y * up);
// Raymarch
float t = raymarch(ro, rd);
vec3 col = vec3(0.1, 0.15, 0.2);
if (t < 10.0) {
vec3 p = ro + rd * t;
vec3 normal = calcNormal(p);
// Lighting
vec3 lightPos = vec3(sin(time*(1.3 + lightSpeed * 0.05)) * 0.5, 0.8, cos(time*(1. + lightSpeed * 0.05)) * 0.5);
vec3 lightDir = normalize(lightPos - p);
float distance = length(lightPos - p);
float diffuse = max(dot(normal, lightDir), 0.0);
col = vec3(1.0);
vec3 m = map(p).yzw;
col += sin(m.y*120.+cs)*0.9+0.1;
col *= diffuse * (1.0 / (1.0 + distance * distance * 0.5)) + 0.1;
// Draw the point light itself
vec3 lightRay = lightPos - ro;
float lightT = dot(lightRay, rd);
float lightDist = length(lightRay - rd * lightT);
float lightGlow = 0.02 / (lightDist + 0.01);
col += vec3(1.0, 0.9, 0.7) * lightGlow*0.8;
}
fragColor = vec4(col, 1.0);
}
// SLIDER GUIDE (range: -20 to 20 each)
// patternScale: Pattern Scale - controls the frequency/zoom of the fractal pattern (0=default, negative=zoomed out, positive=zoomed in)
// heightMultiplier: Height Multiplier - controls the amplitude of the terrain displacement (0=default, negative=flatter, positive=more extreme)
// cameraHeight: Camera Height - adjusts the vertical position of the camera (0=default 0.4, negative=lower, positive=higher)
// lightSpeed: Light Speed - controls how fast the point light orbits (0=default speed, negative=slower, positive=faster)
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.