outline material with occlusion around actor

Hello,

I recently found out how I can hide the outline behind objects that are in front of the highlighted actor (you can find that thread here Outline Post Process with occlusion - Rendering - Epic Developer Community Forums)

But now I’d like to know how can I make the outline go around the occluding object - something like this:


Thank you,
Z

Could someone please help me, I can’t quite figure out how to do this effect.
Thanks

I’d like to do the same thing as you. I suspect the solution would be similar to how the outline is drawn and you want to see if any of the outlined object’s pixel neighbors are occluded then you want to draw the outline. Hope this helps I’m off to figure it out myself.

If you manage to find a solution, please let me know :slight_smile:

I managed to figure it. It’s similar to Tom’s but the textel nodes are bit different and the end is different as well.

Here’s the overall graph

The indvidual textel nodes look like this
75f6713b5227e8a64b1aab168bb123cec153c993.jpeg

And the end of the graph looks like this
b9756bf96b9c0f1866250bca5ee96d0b462ec19b.jpeg

I added in a parameter for the color so i can be changed. I’m planning on modifying the material at runtime to change it’s color and maybe make it pulse.

Here’s a screenshot where I set the alpha to 1 to make it more noticeable.
c927ae06bcb4e7490112b9c09452d554dc89c55e.jpeg

1 Like

Conceptually, the difference between those two versions is that the first one applies the foreground mask as a final multiply of the sobel edge operation, while the second version applies the masking inside of the sobel operation at each step.

I’m sure there is a more efficient way of doing this to get the same result but this is what I got to work. If there is a more efficient method I’d like to see it.
One caveat of this is that if more than one object is in the custom depth and they overlap the intersection is not outlined, however my plans for now are that i would only have one object in the buffer at a time.

Use Stencils for this, they are great. Here’s how my mat looks with them (took it from here and added stencils )

Is the object occulled in the stencil buffer? If not then it’s a lot like just using the custom depth to outline an object.
Also the custom stencil buffer isn’t available on all platform for instance Mac OS X OpenGL but is available in the metal renderer in 10.11.
I was unable to get it to work even after I upgraded and my macbook pro is new enough to run it.

I’d be interested in seeing a screenshot of your material in action.

Yes it is occluded, that’s what custom boffer at the top does. I didn’t make it draw outline like you did earlier yet. Here’s how it looks:

Just in case someone doesn’t know, you need to set these up in your object’s rendering properties:

And of course turn this on in Project Settings\Rendering:
OutlineMat4.jpg

Hope it helps.

I just tried it and it works like a charm!
Thank you !

Yeah you can outline an object without drawing the occulled parts by adding the custom depth/ scene depth check at the end of mine and not have to use the stencil. I had that working with that addition to Tom Loomans outline material.
But I wanted to draw the outline at the edge were it was also occulled and not just not have it draw, like what numsi550 wanted above.

Gald to be of service and contribute back for all the help i’ve gotten from tutorials. You post about not drawing the outline when occulled helped me figure that part out, which then led to this material.

Oh no, i HAVE TO use the stencil. We have a whole bunch of post process materials that need to have different effect on different meshes based on the mask. So i can have blue outline on meshes in stencil id 4 and yellow outline for id 5, for example. IDs 0-3 are used by another effect, and so on. So i’d say this one is better. Of course if it was the only thing i would use custom depth for, i wouldn’t bother with stencils.

I thought thats why you were probably using it so you could get more than one outline color.