extern vec2 center; extern number time; extern number intensity; extern vec2 screenSize; // Hexagon grid logic // Returns distance to nearest hex center float hexDist(vec2 p) { p = abs(p); float c = dot(p, normalize(vec2(1.0, 1.73))); c = max(c, p.x); return c; } vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) { // Normalize coordinates to -1..1, correcting for aspect ratio vec2 aspect = vec2(screenSize.x / screenSize.y, 1.0); vec2 uv = (screen_coords / screenSize.y) - (center / screenSize.y); // Wave parameters float dist = length(uv); float speed = 5.0; float waveWidth = 0.1; float decay = 1.0 - smoothstep(0.0, 1.5, dist); // Decay over distance // Calculate wave pulse float wavePhase = time * speed; float pulse = smoothstep(waveWidth, 0.0, abs(dist - mod(wavePhase, 2.0))); // Hex grid pattern (visual only) vec2 hexUV = screen_coords * 0.05; // Scale grid // Basic hex grid approximation vec2 q = vec2(hexUV.x * 2.0/3.0, hexUV.y); // Distortion vec2 distort = normalize(uv) * pulse * intensity * 0.02 * decay; vec2 finalUV = texture_coords - distort; // Sample texture with distortion vec4 texColor = Texel(texture, finalUV); // Add divine glow at the wavefront vec4 glowColor = vec4(1.0, 0.8, 0.4, 1.0); // Gold/Kitsune-fire color texColor += glowColor * pulse * decay * 0.5; return texColor * color; }