Is it possible to shrink outlines as they gain distance?

I’m new to UE4, so I’ve been messing around with post processing in the Stylized Rendering example (Stylized_Kingdom). Did some basic stuff to learn what does what and dabbled in adding in some other stuff. Anyways, one thing lead to another and information on the subject of post processed outlines began to look scarce as I ventured in deeper.

I found myself doing my own thing. One thing I was messing around with was limiting the rendering distance of the post processing lines. I then came to be curious around the idea of gradually shrinking outlines until they fade off into the distance of said limit. Everything I’ve seen on outlines so far just kept the outlines the same size. I haven’t seen post processed outlines that shrink as they become more distant from the camera, which had planted a little seed of doubt that I would be able to do such a thing.

Does anybody know if it is possible to gradually shrink post processed outlines as they go deeper into the scene? I’d love some information if it is possible.

Just did something similar recently though I don’t have the post process material around right now. In general it’s pretty easy - wherever you control your line width (e.g. sampling radius) you multiply it by the depth buffer. Of course you’ll need to remap the depth to some sensible values (1.0 close to the camera and then falling off into the distance).

That already gave me quite decent results. At least for a starting point that should work.