Outline on invisible object?

Hello, is it possible to get a post-process outline to show on objects that are invisible in any form?

Awesome stuff! I’ll try a google on SetRenderCustomDepth and see if I can’t find the post by the Epic artist, thanks man!

Hey,

This is possible using post processing and the stencil buffer or just standard buffer. One of the Epic artists did a post about it but I cant find the link, so heres a external link to the shader I have used before.

What I do is disable or enable the depth on the mesh with a “SetRenderCustomDepth” blueprint node, so you could drive this when something is invisible, then the post process shader will auto render it as soon as custom depth is enabled.

http://www.tomlooman.com/outline-effect-in-unreal-engine-4/

This however will only work when the actor is set to render (SetActorHiddenInGame(false)).

I for my part would like to outline something that is hidden in game. You could do something ugly like switching the material to something transparent. But this will cause higher rendertimes for the transparent object.

Any idea on how to outline a hidden actor?

I was messing around with this lately, and I think the trick is to toggle “Render in Main Pass,” instead of the “Visibility” settings.

Changing an object to “Hidden” will, I assume, not make it available for any rendering, post-processing or otherwise. If you leave the object “Visible” but then turn off “Render in Main Pass” (under the Rendering advanced settings), the object will be visible but not get displayed. Then, change “RenderCustomDepth” to true, and it should display your outline.

Whenever you want the object’s main body to show up, just set “Render in Main Pass” to true.

2 Likes

Wow, incredible, thanks man. Works like a charm. Now I finally understand what that means.

Do you also know if SetRenderInMainPass(false) and SetRenderCustomDepth(false) basically is the same as SetActorHiddenInGame(true) in terms of performance?

I would guess that HiddenInGame is probably better for performance, off the top of my head, but I can’t say just how much better. This is easy to test for yourself though. Spawn a few tens/hundreds of actors and then use the console command Profile GPU in game, once with your first scenario and once with your second. See if it makes a difference.

Okay, will have a look. Thanks

Thanks for your solution, It does not work in 4.26 and the engine renders the object in black, but it’s ok in 4.20 as I tested…
Is there any solution for 4.26?

Figured out in UE5, the solution there is to just turn off the “Render in Depth Pass” box, and keep the “Render CustomDepth Pass” selected. Then the object will only render as a mask to the custom depth as a stencil. Caveat is that it needs custom stencils activated.

3 Likes

You are a legend. Thank you kind sir/ma’m.