Proper way to invoke Post-Process shader

Good day!
I’m trying to write post-process shader. I’m using PostProcessDOF and LightShaftRendering as examples. Everything seem to compile, though i’ve faced a lot of linker problems.
At the moment i have:

  1. Simple hlsl shader, which is changed to .usf format and put into engine shader folder;
  2. Custom plugin, which shall handle shader settings, invokation etc;
  3. Extended TRenderingCompositePassBase class with overriden Proccess() in it;
  4. C++ wrapper classes for my shader functions.

The main questions are:

  • How to invoke shader processing properly?
  • How and from where do i start Process()?
  • Where do i get FRenderingCompositePassContext, is it fine to create one myself?
  • What’s the right way to get ViewFamily? Should i make it from GetWorld()->Scene + other params?

I’ve spent alot of time, trying to research it myself, reading through Renderer code etc. And still got tons of questions to research.
Would really appreciate any help!

Best regards, Dennie.

Still hope to get help or at least a tip.
There are lots of information to handle, and i’m afraid, i’m missing some small but crucial detail. If anyone’s got ideas, how to setup input texture and how to get back result, your advise would be really helpful!

You have to register your created pass with the pipeline to be executed at the post processing stage in the deferred renderer. Each pass is executed by the composite pass context, you do not create it. Each pass is recorded in the order it was created. The context will simply go through the list of recorded processes and execute them (call process) and will pass itself as a parameter. Here is an example of motion blur pass:

FRenderingCompositePass* MotionBlurPass = Context.Graph.RegisterPass( new(FMemStack::Get())    FRCPassPostProcessMotionBlur( GetMotionBlurQualityFromCVar(), 1 ) );
MotionBlurPass->SetInput( ePId_Input0, Context.FinalOutput );
MotionBlurPass->SetInput( ePId_Input1, Context.SceneDepth );
MotionBlurPass->SetInput( ePId_Input2, VelocityInput );
MotionBlurPass->SetInput( ePId_Input3, MaxTileVelocity );
 					
Context.FinalOutput = FRenderingCompositeOutputRef( MotionBlurPass );

You define the inputs from whatever the previous passes did, or directly from the context. You set the output object with your pass to the final object of the context, or any other temporary output that you would like to use. Note, that it is up to you to resolve the target. Look at PostProcessing.cpp to understand the entire PP pipeline.

To get ViewFamily (inside your composite pass):

    const FSceneView& View = Context.View;
    const FSceneViewFamily* ViewFamily = View.Family;

Hope this helps.

Hi!
Thank you so much for the answer! Now i see, that i hadn’t registered my custom pass. You answer is very helpful!
Thanks again!

Does it mean that one have to change the engine code ?
otherwise how would I get the FRenderingCompositePassContext and/or FViewInfo