How to add a new postprocessing shader?

Assuming, I want to integrate an extensive pixel shader with lots of parameters, what is the best way to do this?

My idea is to just copy an existing filter (eg bloom or vignette) and then put my code into it.

  1. -Can I do this only in the engine code, or is this possible as a plugin?
  2. Where can I find the list/registration of filters, so my shader can be found and gets displayed in the filter list?
  3. Is it a good idea, to have the basic parameters in the parameter panel (like the other filters do) and an additional window, which opens by clicking an “expert” button?

Hey rotwang -

Not knowing exactly what you want to do, I would recommend just working to develop a post process material in UE4’s Material editor which can then be assigned to either the Global Post Process volume for a level or a specific post process volume. Here is a link to the post process material documentation. Also here is the documentation to how the engine deals with post processing.

Cheers -
Eric Ketchum

Thank you, Im talking about pixel shaders, a GLSL coded fragment shader, applied to the full fram/volume. So I think developing a material in the editor would not be the way.

Assumed Steps:

1. Looking for a simple postprocessing shader which has its own panel and can be used as a template.

I think, the class PostProcessDOF can be used as template,
looks like this class has its own panel.

2. Find out, how to connect this class to the actual shader code and how to setup the parameters of the pixel shader.

Haven’t looked into this yet.

3. Create a user panel for the parameters of the new post processing shader

Haven’t found the associated GUI code yet.

4. Register my shader

There must be a list of activated postprocessing shaders and I have to add my class
or an instance to this set.

If you want to add a new post process in C++ and HLSL. Then you will need to look at the following classes:

  • Extend FGlobalShader for your Vertex Shader and for your Pixel Shader. Look at the other Post Processing effects to see how to set it up. Basically you add DECLARE_SHADER_TYPE to your class and then IMPLEMENT_SHADER_TYPE or IMPLEMENT_SHADER_TYPE2 depending on your needs to tie it to your USF file. (For this to work in a plugin you need to make sure that the LoadingPhase is set to PostConfigInit, to allow the shaders to be added to the global list)

  • Extend TRenderingCompositePassBase to define your actual Post Process, override Process and thats where you set your render targets, states, shaders, etc.

This is a very advanced area, I would suggest you do a lot of research before embarking down this path, especially if your Post process could easily be created as a material post process instead.

As for implementing the GUI side of things, can’t help there yet.

Thank you for the details, I used the PostProcessDOF as template, changed the naming of classes, parameters and the usf shader. All compiled fine and the shader gets loaded.
Now, to actually try out the processing, I somehow have to connect this to the GUI with a parameter panel.

Anybody there at Epic, who knows how to do this?

I somehow have to connect the shader to the GUI with a parameter panel.
Where can I find the bridge between parameters and gui panel?

Hi,do you finished it?I’m trying to add a screen blending shader for my special effect.I failed just like you did before.Do you find out some demo?

Extend TRenderingCompositePassBase to define your actual Post Process, override Process and thats where you set your render targets, states, shaders, etc.

Where should one extend it ?