GPU 实时像素排序
BitonicPixelSorter on WebGPU,Noboru Seto (ruccho),2020 年

正在布展…
它是怎么做的
- 第 1 步按亮度阈值把每一行切成若干“区间”
- 第 2 步在计算着色器中用双调排序网络对每个区间排序
- 第 3 步双调排序的每个比较-交换阶段都可大规模并行
- 第 4 步排序方向和阈值可调,生成不同的拉丝效果
复刻配方
一段技术配方,可以直接交给 AI 编程助手,也可以自己照着写。想指定技术栈、位置和性能预算,就把它加入实现方案。
For each row of the image, mark span boundaries wherever luminance crosses a lower or upper threshold, so only mid-brightness runs get sorted. Load each row into workgroup shared memory in a compute shader and run a bitonic sorting network over it, comparing keys only within the same span (using span id as the high bits of the sort key). Write the sorted pixels back and repeat per frame for video input. Expose threshold and sort direction (rotate the image before and after) as controls.


