Blur silhouette of mesh with material or post processing??

I am attempting to create a material or pp material that will effectively blur the silhouette of a mesh. I need to be able to detect edges and then blur inward. I would use this mask as an alpha to blend between postprocessing0 and the mesh render itself.

I know that I can create an outline with a pp material and flag meshes I want to inherit the outline as “render custom depth.” But how would I then blur inwards?

Here is an example:

So I need a way to render this mask somehow… either within a material… or a pp material.

I would then use this mask to create a translucency mask that would effectively blur the silhouette.

Here is the post process material:

A bit involved but not as expensive as I expected.

2 Likes

This is how it looks like:

1 Like

This is fantastic. This is very much so what I was thinking. I will implement this asap. Thank you very much for helping me expedite this! I will let you know how it goes!

If you found an answer helpful then please mark it as accepted. :slight_smile:

i guess the result of the last division on the right must be connected to the emissive color in the PP material right?it doesn’t seem to work in UE5 btw, anyone managed to make it work?

Thanks a lot for your answer, I’m currently having the same issue. Question - this node that you marked as “tweak to match aspect ratio”, is that a constant3vector node? I was following your node structure, and because of this particular nod I’m having errors. Thank you!

Hello, has anyone gotten this to work in UE5?

The aspect ratio is a vector 2, on the image it has the value of (1, 1.6). It should be matching the screen aspect ratio to make the blur steps even on both screen axes.

The technique should work in UE5. What seems to be the problem?

I managed to get this working in UE5 after I asked the question. I couldn’t get it to work in the Quest3 headset though.

Yeah, standalone headsets are very limited. :\

Did you modify something to get it working in UE5?

1 Like

Hi ZoltanE thx for the material!I managed to make it work and it does look awesome indeed. Only problem is that when the PP material is enabled, it has noticeable impact on the whole scene (especially lights). I would expect it to only affect actors with Render CustomDepth Pass enabled, did I do something wrong or is this a drawback of this technique?

Hm, I’m not sure what could be going on… Could you post a few images to show the issue? Something like a before/after comparison.

I added this node setup connected to the rightmost node of your original setup and it seems to look fine now. It was probably already implied to connect it to something like this, but it took me a while to figure out