x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 31 '16 at 09:54 AM in Rendering

avatar image

Dennie Seth
18 2 5 9

avatar image Dennie Seth Sep 07 '16 at 08:21 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Oct 19 '16 at 07:23 PM

avatar image

kudovickij
88 4 5 9

avatar image Dennie Seth Oct 19 '16 at 07:30 PM

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!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question