How to avoid outline shader not override other stencil outline color?

Hi, folks ! I am facing a problem with my outline shader.The shader support multiple color at once like in the image bellow.

You can see that the two color are completely rendered fine. But the problem start to appear when you take camera angle when two object with outline merge together. The object rendered behind of the front one start to cover the front one with it’s own outline color.

I can’t figure out the problem and I have no clue what to do to avoid this problem I had uploaded my blueprint here.Can this be solved?

And extra problem here is that sometime when the camera get closer to the front object the outline of the object behind start to change.

Here is my material Instance settings.

i usually love blueprintue but there are nodes that have no name and it’s a bit more complex than the time i can put. so i haven’t checked it.

my assumption is that the issue is with the part that selects which color to use. somehow it’s not exclusive. since you’re working with numbers it’s quite possible.

in case it helps you here are some materials i’ve made for making outlines, it’s not perfect but maybe it helps you. it’s foss.

Thank you very, but when I copied your uasset directly to my explorer it didn’t show up in content browser.

This shader here helped me to solve the issue.I guess the problem were in calculation used in alpha.

1 Like

It’s a 5.6 asset. Not sure which version you use.

Afaik you cant just drop the asset in a folder, youll have to put the plugin where it should. Maybe on a blank project if you want to experiment.

Im glad youve solved this.

Same 5.6.1 here.