Project_2026-01-16_12-49-32
GLSL shader by scry · created 2026-01-16 · 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/40. //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)
// Hyper Anti-aliasing quality setting (9-12 for extreme quality)
// 9=256 samples, 10=512 samples, 11=1024 samples, 12=2048 samples
#define AA_QUALITY 4
void render(out vec4 fragColor, in vec2 fragCoord);
// Halton sequence generator for high-quality sampling
vec2 halton(int index, int base) {
float result = 0.0;
float f = 1.0;
int i = index;
while (i > 0) {
f = f / float(base);
result = result + f * float(i % base);
i = i / base;
}
return vec2(result, fract(result * float(base)));
}
// Optimized sampling patterns for different quality levels
vec2 getSampleOffset(int index, int quality) {
if (quality <= 8) {
// Use standard patterns for quality 1-8
if (quality == 1) return vec2(0.0);
else if (quality == 2) {
vec2 offsets[4] = vec2[4](
vec2(-0.25, -0.25), vec2(0.25, -0.25),
vec2(-0.25, 0.25), vec2(0.25, 0.25)
);
return offsets[index];
}
else if (quality == 3) {
vec2 offsets[9] = vec2[9](
vec2(-0.33, -0.33), vec2(0.0, -0.33), vec2(0.33, -0.33),
vec2(-0.33, 0.0), vec2(0.0, 0.0), vec2(0.33, 0.0),
vec2(-0.33, 0.33), vec2(0.0, 0.33), vec2(0.33, 0.33)
);
return offsets[index];
}
else if (quality == 4) {
vec2 offsets[16] = vec2[16](
vec2(-0.375, -0.375), vec2(-0.125, -0.375), vec2(0.125, -0.375), vec2(0.375, -0.375),
vec2(-0.375, -0.125), vec2(-0.125, -0.125), vec2(0.125, -0.125), vec2(0.375, -0.125),
vec2(-0.375, 0.125), vec2(-0.125, 0.125), vec2(0.125, 0.125), vec2(0.375, 0.125),
vec2(-0.375, 0.375), vec2(-0.125, 0.375), vec2(0.125, 0.375), vec2(0.375, 0.375)
);
return offsets[index];
}
else if (quality == 5) {
vec2 offsets[25] = vec2[25](
vec2(0.000, 0.000), vec2(-0.326, -0.406), vec2(-0.840, -0.074), vec2(-0.696, 0.457),
vec2(-0.203, 0.621), vec2(0.962, -0.195), vec2(0.473, -0.480), vec2(0.519, 0.767),
vec2(0.185, -0.893), vec2(0.507, 0.064), vec2(0.896, 0.412), vec2(-0.322, -0.933),
vec2(-0.792, -0.598), vec2(-0.345, 0.174), vec2(0.186, 0.469), vec2(-0.897, 0.417),
vec2(0.054, -0.540), vec2(0.759, -0.650), vec2(-0.423, 0.886), vec2(0.377, 0.927),
vec2(-0.715, -0.700), vec2(-0.024, -0.166), vec2(-0.594, 0.058), vec2(0.847, -0.469), vec2(0.351, 0.287)
);
return offsets[index] * 0.4;
}
else if (quality == 6) {
float step = 1.0 / 6.0;
int x = index % 6;
int y = index / 6;
return vec2((float(x) + 0.5) * step - 0.5, (float(y) + 0.5) * step - 0.5);
}
else if (quality == 7) {
float angle = float(index) * 2.3999632297286533;
float radius = sqrt(float(index)) / sqrt(49.0) * 0.5;
return vec2(cos(angle), sin(angle)) * radius;
}
else { // quality == 8
float step = 1.0 / 8.0;
int x = index % 8;
int y = index / 8;
float jitterX = fract(sin(float(index) * 12.9898) * 43758.5453) * 0.1 - 0.05;
float jitterY = fract(sin(float(index) * 78.233) * 43758.5453) * 0.1 - 0.05;
return vec2((float(x) + 0.5) * step - 0.5 + jitterX,
(float(y) + 0.5) * step - 0.5 + jitterY);
}
}
else {
// Hyper quality levels (9-12) using Halton sequences
vec2 halton2 = halton(index, 2);
vec2 halton3 = halton(index, 3);
vec2 offset = vec2(halton2.x - 0.5, halton3.x - 0.5);
// Add some blue noise characteristics for better distribution
float angle = float(index) * 2.3999632297286533;
float radius = sqrt(float(index)) / sqrt(1024.0) * 0.3;
vec2 blueNoise = vec2(cos(angle), sin(angle)) * radius;
return offset + blueNoise * 0.1;
}
}
int getSampleCount(int quality) {
if (quality <= 8) {
int counts[8] = int[8](1, 4, 9, 16, 25, 36, 49, 64);
return counts[quality - 1];
} else {
// Hyper quality levels: 9=256, 10=512, 11=1024, 12=2048
int hyperCounts[4] = int[4](256, 512, 1024, 2048);
return hyperCounts[quality - 9];
}
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec3 col = vec3(0.);
int sampleCount = getSampleCount(AA_QUALITY);
// Accumulate samples
for (int i = 0; i < sampleCount; i++) {
vec4 renderColor;
render(renderColor, fragCoord + getSampleOffset(i, AA_QUALITY));
col += clamp(renderColor.rgb, 0., 1.);
}
// Average the samples
col /= float(sampleCount);
fragColor = vec4(col, 1.0);
}
vec3 c1(vec2 uv, float t, float ii) {
vec3 col = vec3(0.);
float m = 1.;
float c = exp(-length(uv));
//uv *= r2d(deg*45.*sin(time+c*20.)*0.1);
for (int i=0;i<3;i++) {
uv += cos(uv*5.2+sin(t+vec2(0.,1.57))*4.+ii*c*0.01)*0.02;
uv *= r2d(deg*45.);
}
uv *= r2d(sin(t)*deg*10.);
uv *= 0.1;
//uv = uv/dot(uv,uv)*0.02;
uv *= 2.;
for (int i=0;i<6;i++) {
uv += sin(uv.yx*40.+t)*0.001;
uv *= r2d(deg*45.*0.);
}
for (int i=0;i<15;i++) {
uv = abs(uv)-0.03;
}
uv *= 1.;
uv *= r2d(t);
uv = uv/dot(uv,uv)*0.03;
for (int i=0;i<4;i++) {
uv += sin(uv.yx*14.+t)*0.01;
uv *= r2d(deg*45.*0.);
}
uv *= 2.;
uv *= r2d(-t);
uv = uv/dot(uv,uv)*4.;
m *= sin(uv.x*0.9+t*4.)*0.5+0.7;
m *= cos(uv.y*0.9+t*4.)*0.5+0.7;
for (int i=0;i<9;i++) {
uv += sin(uv.yx*7.)*0.15;
uv *= r2d(deg*45.*0.);
}
m *= -sin(uv.x*0.9+t*4.)*0.5+0.7;
m *= -cos(uv.y*0.9+t*4.)*0.5+0.7;
uv *= r2d(sin(t+uv.x*0.05)*deg*45./2.);
col += sin(uv.x*20.+t*4.+cs);
col *= m;
col *= 2.99;
col = clamp(col,0.,1.);
return col;
}
void render(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
vec2 tv = uv;
uv -= 0.5;
uv.x *= ar;
vec3 col = vec3(0.);
float c = length(uv);
vec3 cc = c1(uv,time,0.);\
// Create emboss effect using offset samples as a normal map
float offset = 0.003;
vec3 c_right = c1(uv + vec2(offset, 0.), time, 0.);
vec3 c_left = c1(uv - vec2(offset, 0.), time, 0.);
vec3 c_up = c1(uv + vec2(0., offset), time, 0.);
vec3 c_down = c1(uv - vec2(0., offset), time, 0.);
vec3 normal = vec3(c_right.r - c_left.r, c_up.r - c_down.r, 1.0);
normal = normalize(normal);
// Light direction (from top-left)
vec3 lightDir = normalize(vec3(0.5+sin(time*10.+c), 0.5+cos(time*10.+c), 0.0));
// Calculate lighting
float diffuse = max(dot(normal, lightDir), 0.0);
// Apply emboss effect
col = vec3(0.2+cc*4.)*(0.3 + 0.7 * diffuse);
col += vec3(diffuse * 0.4); // Add highlight
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.