Unity's RenderTexture and Camera Replacement Shader analogy

Hello community,

I am fighting with some tricky and uncommon task and it seems i am stuck.
I am trying to port solution from Unity which involves such features as

These features allow me to define custom camera, set specific shader to it and then render result to texture.
‘Replacement Shader’ can be used instead current shader (material) for each object on scene.
It can take specific parameter from material - e.g. you can add material parameter FillColor=255.
Current shader will skip it, but Replacement Shader will take it as argument.

So that we have:
Usual camera which renders scene for user,
second camera with same positioning but with Replacement Shader which renders to texture.
In next step we analyze that texture and consider result in game logic.

Can you please help me to find analogy for UE4? How do you think that can be implemented using UE4? C++, HLSL, Blueprints - no matter.

I am looked to SceneCapture2D and RenderTarget but when i am trying to use them i see a lot drawbacks.

Scene renders second time, applying all materials, textures and lighting
My shader in Unity quite simple and precise, if i want to render some object with FillColor=255 it does work.
That i achieve now - is to apply some postprocessing to rendering result,
and it is impossible to set FillColor=255 for object, because other effects from initial shader are also applied.

Thanks in advance.


UPD Following Krxtopher request - here is ‘end result’ that i need to achieve in UE4 (achieved in Unity and trying to port):

I need image which is captured from current camera view but with applying specific shader.
All non-transparent objects on scene must be rendered as black areas (replacing all object pixels with black pixels) - except certain set of objects. Objects from this specific set are rendered with certain ‘FillColor’ parameter - all pixels are replaced with pixel of certain color (ideally 24 bit color).
Transparent (or semi transparent objects) must not be rendered at all.

I want to be able to specify this color per object. And want to be sure that resulting image will contain only this ‘specified’ set of colors + black.

skondratov, instead of focusing on the specific implementation you’re trying to port over from Unity, can you describe the actual end result you’re trying to achieve? I ask because perhaps there is a more appropriate Unreal solution that would help you achieve your goal but isn’t a direct analog of the Unity model.

For example, Unreal Engine lets you render objects to custom depth buffers. You can then use this buffer as an input for special processing and effects (such as outline effects as just one example). Perhaps if we knew more what the you wanted the end result to be we could advise on more options. And screenshots or videos demonstrating the result you’re striving for are always helpful, too!

Hi, Krxtopher thank you for response, i updated my question.

bump,

still relevant(

You are still describing way, not a goal. Doing what you laid down is doable from code. Most likely not doable efficiently from BPs.