Neon diamonds
GLSL shader by merrypranxter · created 2026-02-12 · 10s loop · 2 passes
Tags: 2d, Texture, Animation, Abstract
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)
// --- 1. THE DEFINES (TUNE THE LUXURY) ---
#define SPEED iTime * 5
#define WEAVE_DENSITY 8.0 // HOW INTRICATE THE PATTERN IS
#define SPARKLE_AMOUNT 1.5 // THE "DIAMOND DUST" FACTOR
#define WARP_LAYERS 5.0 // THE COMPLEXITY OF THE FLOW
// --- 2. THE MATH ENGINE (THE LOOM & PALETTE) ---
mat2 rot(float a) { return mat2(cos(a), -sin(a), sin(a), cos(a)); }
// A ROYAL, IRIDESCENT PALETTE
vec3 palette(float t) {
vec3 a = vec3(0.5, 0.5, 0.5);
vec3 b = vec3(0.5, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 1.0);
vec3 d = vec3(0.0, 0.33, 0.67); // DEEP BLUES, PURPLES, & GOLD
return a + b * cos(6.28318 * (c * t + d + SPEED * 0.1));
}
// HIGH-FREQUENCY SPARKLE NOISE
float hash21(vec2 p) {
p = fract(p * vec2(234.34, 435.345));
p += dot(p, p + 34.23);
return fract(p.x * p.y);
}
// --- 3. THE RENDERER (THE JEWELED WEAVE) ---
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
// 1. Normalize
vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
vec2 uv0 = uv; // Save for global color
// 2. THE INTRICATE WARP (THE LOOM)
// Weave the coordinates into a complex, flowing pattern
float warp = 0.0;
for(float i = 1.0; i <= WARP_LAYERS; i++) {
uv *= rot(SPEED * 1 / i);
warp += sin(uv.x * WEAVE_DENSITY * i + SPEED) * cos(uv.y * WEAVE_DENSITY * i);
uv += warp * 0.1 / i; // Feedback the warp into itself
}
// 3. THE BASE COLOR (THE SILK)
// Color is based on the final warped position and the original distance
vec3 col = palette(length(uv) * 0.2 + warp * 0.1);
// 4. THE SPARKLE LAYER (THE DIAMOND DUST)
// Create a high-frequency noise that only shows the brightest peaks
float noise = hash21(uv * 50.0 + iTime); // High-frequency UV
float sparkle = smoothstep(0.85, 1.0, noise); // Only the top 15% of noise becomes a sparkle
// Add the sparkles, colored by the palette, for an iridescent glitter effect
col += sparkle * SPARKLE_AMOUNT * palette(noise + iTime);
// 5. FINAL POLISH (CRUNCH & SHINE)
// Enhance contrast and add a soft vignette
col = pow(col, vec3(0.8)); // Make the colors deeper
col *= 1.2 - length(uv0) * 0.5; // Focus the eye
// Ensure no color overflow
fragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
}
Image
Not used
More shaders by merrypranxter
- PRISMACORE_003 — Retina Banquet
- PRISMACORE_002 — After Work Sky
- PRISMACORE_001 — Liquid Crystal Fever Dream
- Hopf Vibratiok in pink
- Void Geode
- Project_2026-02-14_04-53-13
- Chromatic Plexus
- Signal Death
- Deep fried math
- Candy Interference
- Project_2026-02-12_21-16-32
- Project_2026-02-12_17-00-28
Browse all public shaders · All shaders by merrypranxter · ShaderKit home
Unread comments
×Projects with new comments. Click to open and read.