← Experiments
Fragment Shader
▼
precision mediump float; varying vec2 v_position; varying float v_distanceToEdge; uniform float u_time; void main() { // Distance-based glow effect float glow = 1.0 / (v_distanceToEdge * 20.0 + 1.0); glow = pow(glow, 1.8); // Pulsating intensity float pulse = 0.7 + 0.3 * sin(u_time * 2.0); // Enhanced glow with falloff float intensity = glow * pulse; // Multiple glow layers for stronger effect float innerGlow = smoothstep(0.0, 0.05, v_distanceToEdge); float outerGlow = 1.0 - smoothstep(0.0, 0.15, v_distanceToEdge); float finalGlow = mix(innerGlow, outerGlow, 0.5) * intensity; // White color with glow vec3 color = vec3(1.0, 1.0, 1.0); gl_FragColor = vec4(color * finalGlow, finalGlow); }
Reset
Tips:
Edit the fragment shader to see changes in real-time
Try changing the
pow(glow, 1.8)
exponent
Modify the
u_time * 2.0
pulsation speed
Experiment with glow
smoothstep
values
Glowing Heptagon • WebGL Fragment Shader REPL
Live Editing