GLSL shader example
Hex Grid with Per-Cell Pulses
A staggered grid approximates honeycomb cells. Cell IDs drive independent pulses and both border and color share coordinates.
Live example
Edit the code and the preview updates as you type.
What to observe
Hex Grid with Per-Cell Pulses.
Mechanism
A staggered grid approximates honeycomb cells. Cell IDs drive independent pulses and both border and color share coordinates.
The controlling code
vec2 q=p*7.,size=vec2(1.7320508,1.);vec2 a=mod(q,size)-size*.5,b=mod(q-size*.5,size)-size*.5;vec2 cell=dot(a,a)<dot(b,b)?a:b;vec2 id=q-cell;float d=max(abs(cell.y),dot(abs(cell),vec2(.8660254,.5)));float line=1.-smoothstep(.43,.48,d);c=palette(hash(id)+u_time*.12)*line*(.4+.6*sin(hash(id)*6.+u_time));
Experiment
Change q=p*7. to q=p*4.. The honeycomb cells become larger while each cell still pulses according to the hash of its own id.
Debugging and cost
Two staggered candidate grids choose the nearest hex cell; there is no neighbor-sampling loop. Replace u_time*.12 in the palette input with 0. to stop hue cycling while retaining the separate per-cell brightness pulse.