ShadersPlus: Infrastructure for custom shaders

After reading everything I could on creating custom shaders in Unreal, I started this plugin to help me out with boilerplate code. This *should *work for UE versions 4.19 to 4.21, and has only been tested on Win10.

What this plugin doesn’t do
The plugin is almost entirely written for C++ development and not blueprint. Additionally, I haven’t considered any integration with the material editor. It is mostly for running compute shaders.

What this plugin does
Currently this is mainly aimed at compute shaders and draw-to-quad pixel shaders. While there is more functionality, it’s mostly experimental or horribly broken. The two useful features are ShaderInstance and ShadersPlusMacros. For an example of how to use both of these, check out the Combine and Convert shaders. They’re seperated into a shader definition and shader instance, which would typically be stored by the called as a TUniquePtr.

What this plugin may do in the future
There are a few things i’d like to add aside from fixing, improving and adding more options to what’s there. Primarily i’d like to add a shader defintion generator which takes a shader or shader pair (VS/PS) and generates the defintion files for you, either via a tool in the editor or something that hooks into the build process. Perhaps you provide a metadata file (json?) that resides in the same directory as the shaders specifying any other options.

How to use this plugin
For now you can refer to the included Combine and Convert shaders, and i’ll endeavour to make a video tutorial on how to use it with Temaran’s great examples here:

Upgraded my project to 4.21 and swapped from @Temaran shader plugin demo to yours, so far so good!
I’m using 6 compute shaders and fullscreen pixel shader for a fancy atmosphere modelisation :smiley:

I’m glad you find it useful! In the latest push I fixed the DrawPrimitiveUP deprecation warning, and added optional parameters for DrawToQuad so you can tell it to generate mip maps or not (by default it does to match previous behaviour).

Edit: Nevermind, fixed my issue :rolleyes:. It can be quite challenging to get a clean handling of destruction with UObject/RenderTexture alongside those Shaders classes.
Took some extra time but it’s working for now !

What was the issue? I didn’t see before you edited your post. Generally of you’re mixing regular C++ with uobjects you should use a weak reference.

Late answer but if i recall right i was manually deleting some runtime created object, ending up in conflict with the garbage collector. Should be all cleared out now.