Skip to content
A compute shader plugin that is capable of sorting positional data in parallel directly on the GPU.
C++ C C#
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
ComputeShader fixed bug where sorted texture was rotated by 90 degrees Jan 27, 2019
PixelShader finished porting to UE4.21 by using virtual shader paths Jan 23, 2019
.gitignore added PixelShader plugin Jul 16, 2018 Create Feb 14, 2019
LICENSE.txt updated license Oct 16, 2018 Update Feb 14, 2019

Parallel Bitonic Sorting on the GPU by a Compute Shader


Works for UE4.21 (in master branch). For installation, copy both folder to your Engine/Plugins/Runtime folder.


This is a plugin for the Unreal Engine that realises parallel sorting on the GPU via compute shaders. It sorts three-dimensional vectors according to their distance to the current camera position. Currently only textures with maximum size of 1024*1024 are supported, that is, 1 Million points can be sorted in total at maximum.

The texture/problem size has to be set manually in "ComputeShaderUsageExample.h" and "BitonicSortingKernelComputeShader.usf":

const UINT NUM_ELEMENTS = 1024 * 1024;

To sort a dataset with the compute shader, the compute shader has to be used as follows:

mComputeShader = new FComputeShader(1.0f, GetUpperPowerOfTwo(pointsPerAxis), GetUpperPowerOfTwo(pointsPerAxis), currentWorld->Scene->GetFeatureLevel());

// Send unsorted point position data and point color data to compute shader

// Execute parallel sorting compute shader

Furthermore, the created textures have to be converted to usable textures via a pixel shader:

mPixelShader = new FPixelShader(FColor::Green, currentWorld->Scene->GetFeatureLevel());

// Render sorted point positions to render target for the material shader
mPixelShader->ExecutePixelShader(mPointPosRT, mComputeShader->GetSortedPointPosTexture(), FColor::Red, 1.0f);
mSortedPointPosTex = Cast<UTexture>(mPointPosRT);

// Render sorted point colors to render target for the material shader
mPixelShader->ExecutePixelShader(mPointColorRT, mComputeShader->GetSortedPointColorsTexture(), FColor::Red, 1.0f);
mSortedPointColorTex = Cast<UTexture>(mPointColorRT);

If you want to sort the point positions only (without the point colors accordingly), use the "SortingPositionsOnly" branch (speeds up the computation significantly).

To see the plugin in action, see my point cloud renderer plugin for UE4:


The plugin is free for personal and academic use. Commercial use has to be negotiated. For more information, send me an E-Mail or read the

The plugin was created in the context of a master thesis at the CGVR institute of the University of Bremen.



You can’t perform that action at this time.