Trying to add an overlay material that gives meshes an outline and im faced with a wierd issue

im want to add an overlay material outline that shows when players get close to the actor but as seen in the below screen shot of the overlay material, i followed a simple tutorial but the result were not as excpected and i do not know why can some ojne help please?

Hello there @MadLed!

From your shader setup, I would test by inverting the order of the TwoSidedSign, pass it through MinusOne first, then feed it to Multiply, along with a float parameter to control the intensity:

Also, make sure your target mesh has Nanite disabled, as it’s doesn’t interact quite well with Overlays, or doesn’t show up at all (here, same overlay applied, left square has Nanite OFF, right square has it ON):

You can find all the steps on the UE guide below:

hi @brs-sebascova

the mesh already has nanite disabled and i tried to do it the way you told me to and it still game me the same result

and when i try to increase the thickness this happenes

im thinking maybe because the model is low poly or because there is something wrong with its normals, but im not sure

Hello again!

That’s a quite bizzare effect you are getting in your screenshot. And considering your blueprint setup looks correct when compared to the guide and the sample I shared in the previous post, it means the issue shouldn’t be there (at least with the information provided so far).

There’s something outside the material affecting this, and that could be the low poly model, or how it’s normals are being handled. Checking around the community, the overlay effect can be affected when used with a low poly model, but testing with the engine on my end, I was unable to reproduce the effect you are getting, even using a simple cube. What I did find, was how to resolve potential normal conflicts. Open your mesh, check the Build Settings, and ensure the following parameters are enabled:

Once they are all checked, apply changes, save, and test your material again. If the issue persists, at that point I would suggest constructing an alternative material, to rule out any faulty parameter we are not seeing. To do so, follow the video guide below, step by step:

Adding an update for your scenario, after further testing, I managed to reproduce the “split up” effect on a material overlay:

The key is how Nanite was disabled in the project. If the switch is done per mesh basis (meaning, opening each mesh and disabling Nanite support), no issue should take place.

Instead, if it was disabled globally from Project Settings, under Engine > Rendering, while the affected assets still have “Enable Nanite Support” checked in, then the split up effect will appear.

If this is the case, I would suggest avoiding the gobal check off for Nanite, and to disable it per mesh basis, which should prevent the glitch in your overlays.

Hi @brs-sebascova sorry for the late reply and thank you for youe effort in trying to help me

but i checked and saw that nanite was already enabled in the project settings and disabled in the mesh that im testing and it gave the same split up effect no change at all. I even tried disabling the nanite in project settings and enabling it in the mesh and disabling it but still no change.

i have no idea how to fix this and im starting to give up on this idea all together :,)

With hard edges, the adjacent normals point in different directions, causing the faces to appear separated.

While using smooth edges resolves this issue, it changes the visual appearance. I think a good solution is to separate the normals used for lighting from those used for outlines.

In the attached image, you can see how I baked the smooth edge normals for the outline into vertex colors and used them in place of VertexNormalWS.

If you’re using Blender, you can bake vertex colors using Geometry Nodes.
Since vertex colors cannot have negative values, the range of -1 to +1 is converted to 0 to 1.
In UE, after restoring the range to -1 to +1, it is converted to WorldSpace.

hi @t-hoshino im not a blender expert so i couldve done something wrong but i tried following your example and still got this wacky result

starting to think i might have done something horribly wrong when i made these meshes

but when i apply the same effect on other meshes it gives kinda the same result

and this model i did not create myself so im not quite sure why this wont get fixed for me

@t-hoshino @brs-sebascova

is there a possible different approach to achieving the same effect?

for example when i do it like this

it kind of look correct

and when i apply the value to world position offset it gives me the below result

it doesnt look right but at least it is not breaking appart.

is there a way for me to increase the size of the mask a little bit so that it kind of looks like an outline? or any other method that we can use?

If there are issues with the model, it might be better to draw the outline using a post-process material rather than an inverted hull.

If the mesh’s pivot is centered, you might be able to make it look like an outline using the method shown in the attached image, provided the mesh has a simple shape.

Reference for drawing outlines using post-process materials

This approach gave me the desired effect thank you very much

hopefully all of the suggestions above in this post would help somebody else but for me this approach worked perfectly