GPU-accelerated pixel sorter with bitonic sorting for Unity.
The screenshot below shows it running on an NVIDIA GeForce RTX 4070 and it keeps over 1000 FPS at FHD resolution.
Use UPM git dependencies.
-
Open Package Manager and click
+>Add package from git URL... -
Enter
https://github.com/ruccho/BitonicPixelSorter.git?path=/Packages/com.ruccho.bitonicpixelsorter#release -
(Optional) To use a RendererFeature for UniversalRP, also install
https://github.com/ruccho/BitonicPixelSorter.git?path=/Packages/com.ruccho.bitonicpixelsorter.urp#release
| Property | Type | Description |
|---|---|---|
| Use As Image Effect | bool |
It works as an image effect when attached to the camera. This is only active when you are using builtin render pipeline. |
| Shader | ComputeShader |
Set BoitonicPixelSorter.compute. |
| Direction | bool |
Switches sorting direction between horizontal / vertical. |
| Ascending | bool |
Switches ordering. |
| Threshold Min | float |
Lower threshold of the brightness. |
| Threshold Max | float |
Upper threshold of the brightness. |
var sorter = GetComponent<BitonicPixelSorter>();
//BitonicPixelSorter.Execute(Texture src, RenderTexture dst)
sorter.Execute(sourceTexture, destinationTexture);In your renderer asset, add Bitonic Pixel Sorting Feature to the renderer feature list.
https://github.com/hiroakioishi/UnityGPUBitonicSort
https://www.inf.hs-flensburg.de/lang/algorithmen/sortieren/bitonic/oddn.htm
