Outline problem..

Hello everyone, I have a strange problem with my outline, and what exactly happens is that whenever I hoover true more than 1 of those outline objects - their outline does not disappear. Here is an example of my code as well. :

Custom Depth is a render pass.

You can imagine it as black and white picture.
I assume you use the template from Tom Looman.

What that does is during the post process effect take the resulting black & white picture to detect the outlines (if there’s a high contrast) and replace those pixels with color X. Optionally also paint over the whole “white” layer with another color.

It can not distinguish between overlapping outlines. The render pass provides either black or white (well grey for pixels that are partially occupied by a custom render depth object but nevermind that).

There’s no superwhite for when there are multiple ones overlapping.

You can verify this in editor if you click in your viewport on the view mode dropdown (“Lit” by default. In the upper left corner). You can go down to “BufferVisualization” and select “CustomDepth”.
There you can see your level in real time and see how this works practically.

But TLDR: The system you use does not support what you are trying to do here.

What I’m trying to achieve it, when I hover over another outline object (a second one), the first outline should disappear before the second one appears. At the moment, it works like this :
Is looking at an object with tag ‘outline’?
If Yes -> outline appears.
If No -> outline disappears.

Problem is, that when you’re looking at one with outline and move your cursor to another one with outline, the first one doesn’t disappear, since you are still looking at an object that’s outlineable (even if it’s a different one). I want the first object’s outline to disappear and then the second one’s to appear.

Oooh. Sorry for the misunderstanding.

You’ll need to store a reference to the object you’re highlighting.

I would suggest to create a Macro or function “SetOutline”. Within it you check if your “Outline” actor reference exists. If it does check that it’s not the same as the current object. If not set custom render depth to false for the current reference and store the new outline actor in that variable. Enable custom render depth for this new object.

And now call it for every trace you do. If it has a tag, pass that actor to the function. If there’s no tag. Just don’t forward anything. (I’d suggest to not handle that part within the function because that would mean you can’t use it anymore to explicitly highlight something specific).

Could you make an example of that, since I’ve got no idea how to? Thanks a ton!

Well alright. Let’s get specific :slight_smile:

The issue is at setting your custom render depth to false before you apply it to the new one.

Right now you check if the object you hit is of your outline actor type. If so, you set the custom render depth of that actor to false, then set this new actor as your “Outline2” and then enable custom render depth for that actor.

You need to kill your Outline2 instead of the static mesh after that branch.

Okay, I changed this - it works, but it gets an error

Well yeah. It’s possible that variable isn’t set. You regularly intentionally unset it.

You need to check if it’s valid before accessing anything (like setting custom render depth).

…you already did exactly that right above this part in your graph.

I am quite unsure where to set+put is valid… Everything I’ve tried has failed…

Can anyone give me a visual example, I am new in programming, sorry for having to explain it to me like that