Implementing an effect requiring multiple render targets and post processing passes

Hello,

I am trying to implement an effect that at a high level works as in the attached image (render_setup.png).

To describe the image in words:

  1. Render all the scene geometry using the standard rendering pipeline into “scene color render texture”
  2. Render a subset of the scene geometry (e.g 2 boxes) using the standard rendering pipeline (but different materials to step 1) into “custom color render texture 1”
  3. Render the same subset of the scene geometry using the standard rendering pipeline (but different materials to step 1 and 2) into “custom color render texture 2”
  4. Transform custom color render texture 1 using a fullscreen effect in a post processing material
  5. Composite the result of step 4 with “custom color render texture 2” and “scene color render texture” using a post processing material and have the result displayed to the screen

In attempting to do this I hit 2 major problems:

  1. In the first post processing pass I have access to what I have called “scene color render texture” through SceneTexture:PostProcessInput0. This has been overwritten in the second pass by the result of the first pass so no longer available for compositing. I don’t want to capture the entire scene using a SceneCapture2D to have this input in a texture because that would involve rendering the entire scene twice, which is prohibitively expensive.
  2. I don’t have any facility to create or render into what I have called “custom color render texture 1” or “custom color render texture 2”. I guess I could potentially use the custom depth buffer for one of the operations and lose my color information but that would still leave me a render texture short.

Is what I am trying to do even conceptually possible in Unreal 4 (with or without engine modifications) or should I just abandon this? If this is only possible with engine modifications would they be stable enough to actually use in a shipping game?

Regards,

Phil

Hey PhilMaguire -

The Render Pipeline you are describing is possibly in the engine with some extensive rewrites to the the base rendering pipeline in the code. From a performance standpoint there are always ways to optimize code and processes to get maximum effect, but I cannot comment as to whether you would be able to get the rendering pipeline down to allow for real time rendering purposes. Your pipeline as describing multiple render paths every tick.

To directly answer your last few questions, yes it is conceptually possible in UE4 with extensive engine modifications. And as for the stability that would entirely depending on your programmers and their time to program and debug the problems that you will come across.

Thank You

Eric Ketchum

Thanks Eric,

This confirms what I was thinking. I’ve been investigating alternative solutions to achieve a similar end result. One of these is looking promising and wouldn’t require any (or at least as extensive) modifications. I think I will leave this approach for now and focus on my new solution instead.

Thanks again,

Phl

Hey Phil,

I’ve been attempting to achieve a similar PP pipeline, and I’m curious about the alternative solution you’re pursuing. Could you explain it?

Hi Kazhiim,

My alternative solution involved procedurally generating geometry so that I could generate a similar effect to the post processing end result I was after without the flexible PP pipeline. It’s currently a lot more expensive in performance-terms but I’m hopeful to use a compute shader to offset that - though I need to investigate that once I’ve finished the geometry generation successfully.

I suspect this isn’t so helpful for you as I couldn’t find an alternative to achieve what I wanted using the PP pipeline that I was confident to use in a shipping game.