Examples of compute shaders with 4.26+?

I’ve been following this guide for adding compute shaders, but it was done in 4.24, and I’d like to use 4.26 (preferably even ue5… was RHI stuff refactored between 4.26 and 5?)

Looks like the some RHI API was refactored between 4.24 and 4.26, and so trying to compile the example code results in errors like error C3861: 'UnbindRenderTargets': identifier not found
Does anyone know of any examples (tutorials even?) of compute shaders done in 4.26?
If not, maybe some pointers to what pieces of code/documentation I should be looking at?

Any and all input is appreciated, thanks!

Mip map generation shader in the engine is currently the best example and tutorial of how to use compute shaders the modern way, that being through RDG.

1 Like

I managed to make it run in 4.26 by removing the UnbindRenderTargets line (seems to be deprecated) and changing *whiteNoiseCS to whiteNoiseCS in line 135 of ComputeShaderDeclaration.cpp.

1 Like

There’s also ShadersPlus (ShadersPlus: Infrastructure for custom shaders) that compiles in 4.26, but I have not figured out how to to use it yet. I would appreciate any suggestions or pointers.


Just searching GitHub for the right keywords is a decent way to learn!
Examples found:

Sometime in June I stumbled across the UE4ShaderPluginDemo by @Temaran. This example was useful with regards to some hints as to how to structure a plugin for use with custom shaders (I’m a noob to both graphics AND making plugins). Though it was a little outdated, with some deprecation warnings related to using EResourceTransitionPipeline::EGfxToCompute and EResourceTransitionAccess::ERWBarrier. I spent some time trying to understand the above example, until eventually hitting a wall regarding how to allocate/create a buffer big enough to dump some vertex data in, namely a StructuredBuffer/UAV. The only info could really find on the topic came from an Unreal Answers post on “Loding data to/from structured buffers”. The solution described here made use of the FRDGBuilder to create a structured buffer, which felt somewhat incompatible with the methods that the UE4ShaderPluginDemo used. (It’s probably not actually incompatible, I just don’t understand the RHI/RDG and their relationship well enough to integrate it :stuck_out_tongue: )

I eventually found this example on GitHub: UE4-OceanProject/ComputeShaderDev. This example feels simpler than the example from Temaran, and is a little closer to what I’m trying to achieve.