Find specific object's screen location in post-processing material

Hi all!

I am trying to make a custom blur filter, which would be able to blur out specific objects in my unreal project. So far, I have managed to set up a post-processing material which can blur out specific sections of the screen. What I need now is a way to obtain the screen coordinates of specific objects so that the post-processing material knows exactly where to blur. Is this possibe?

I’ve included an image to show what I’ve managed to do so far:

And this is my post-processing material graph so far:

So basically I need to set the CenterPosition param in the RadialGradientExponential node to always be the center of the shape you can see in the first image, translated to screen coordinates so that the post-processing material can use it. Any help would be greatly appreciated! If you have more straightforward ideas to achieve what I have in mind I’ll take those too :slight_smile:

Hello! You can use Custom depth to add some effects on specific actors (Custom Depth in Unreal Engine 4 - Tom Looman, Custom Depth and Custom Depth Stencil in UE4 - Superyateam Gamedev)

Hi Kehel18! Thanks for your reply! I actually looked into using custom depth but I ran into the problem that the stencil is exactly around the object, where for my needs I preferred something that would extend beyond it and blur into the background a bit.

In the end I managed by just putting a sphere over the object and applying the same mosaic blur from my original material graph that I posted to the sphere, using the SceneColor to set its emmisive channel. Then I faded out the sphere material by applying a fresnel node to its opacity channel.

Technically, I think it should also be possible to use the fresnel node to blur the alpha mask for the post-processing material in case you are using custom depth after all. This would be a more effective and generalizable approach, but tbh I can’t be bothered anymore and what I’ve got now looks good!

Thanks again, I’ll mark this topic as solved :slight_smile: