BitonicPixelSorter

December 16, 2025 ยท View on GitHub

GPU-accelerated pixel sorter with bitonic sorting for Unity.

Live Demo (WebGPU port)

The screenshot below shows it running on an NVIDIA GeForce RTX 4070 and it keeps over 1000 FPS at FHD resolution.

Image

Installation

Use UPM git dependencies.

  1. Open Package Manager and click + > Add package from git URL...

  2. Enter https://github.com/ruccho/BitonicPixelSorter.git?path=/Packages/com.ruccho.bitonicpixelsorter#release

  3. (Optional) To use a RendererFeature for UniversalRP, also install https://github.com/ruccho/BitonicPixelSorter.git?path=/Packages/com.ruccho.bitonicpixelsorter.urp#release

BitonicPixelSorter Component

image

PropertyTypeDescription
Use As Image EffectboolIt works as an image effect when attached to the camera. This is only active when you are using builtin render pipeline.
ShaderComputeShaderSet BoitonicPixelSorter.compute.
DirectionboolSwitches sorting direction between horizontal / vertical.
AscendingboolSwitches ordering.
Threshold MinfloatLower threshold of the brightness.
Threshold MaxfloatUpper threshold of the brightness.

Use from code

var sorter = GetComponent<BitonicPixelSorter>();

//BitonicPixelSorter.Execute(Texture src, RenderTexture dst)
sorter.Execute(sourceTexture, destinationTexture);

Use RendererFeature for UniversalRP

In your renderer asset, add Bitonic Pixel Sorting Feature to the renderer feature list.

References

https://github.com/hiroakioishi/UnityGPUBitonicSort

https://www.inf.hs-flensburg.de/lang/algorithmen/sortieren/bitonic/oddn.htm