Fragment shader playground

One tiny program, run once per pixel, in parallel, knowing nothing about its neighbours. Switch snippets and watch the code change next to the picture.

Vertex shader — runs once per corner of the quad (4 times total)
Fragment shader — runs once per pixel, in parallel (count below)

What to notice. The sliders are just two float uniforms — same value for every pixel in the frame. v_uv is a varying: the vertex shader wrote it at four corners and the rasteriser interpolated it to every pixel for free. In Branch vs mix the top half uses if and the bottom half mix(); identical image, but the branch makes the whole warp walk both sides and can't be softened by the edge slider.

← all demos