Line with pink and purple gradient
Unreal Blueprint graph calling a compute shader

Bare-bones setup

Bare-bones Compute Shader in UE5

A minimal compute-shader scaffold. Great as a starting point for new shaders or for learning the basics of how shaders are defined in Unreal.

Get the code

$ shadeup-unreal
 > [COMPUTE] Compute Shader
 > Base
OR

Usage

  1. Generate or download the template using the instructions above
  2. Rebuild your project
  3. Create or navigate to an existing Blueprint
  4. Right-click and add the node called “Execute Base Compute Shader”

Notes

Helpful reading


Sample snippet

// base.usf

#include "/Engine/Public/Platform.ush"

Buffer<int> Input;
RWBuffer<int> Output;

[numthreads(THREADS_X, THREADS_Y, THREADS_Z)]
void BaseExample(
	uint3 DispatchThreadId : SV_DispatchThreadID,
	uint GroupIndex : SV_GroupIndex )
{
	// Outputs one number
	Output[0] = Input[0] * Input[1];
}