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"

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.

Product Version: UE 4.18
more ▼

asked Mar 02 '18 at 07:08 PM in Rendering

avatar image

1 2 3

avatar image Krxtopher Mar 02 '18 at 09:22 PM

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!

avatar image skondratov Mar 05 '18 at 10:52 AM

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

avatar image skondratov Oct 08 '18 at 09:13 AM


still relevant(

avatar image Deathrey Oct 08 '18 at 09:55 AM

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

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

0 answers: sort voted first
Be the first one to answer this question
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