Download

Custom Depth Stencil post process issue

Can anyone help me understand something about custom depth stencils?
I’m trying to use a custom depth layer to post process some actors differently from the rest of the scene. I’ve got it working the way I want, except the effect on the desired actors isn’t uniform within the custom depth stencil boundaries. The right side of the stencil (on screen) isn’t affected the same way as the left, creating an undesired effect.

this video demonstrates the artifacting I’m getting perfectly:
https://www.youtube.com/watch?v=FbAt-lxXtj4&feature=youtu.be

As you can see, the left side is visually pixelated at the edges, creating aliased pixels against the background, this is what I want. However, the right side essentially remains unaltered up against the edge of the stencil, allowing the original silhouette of the actor to be seen clearly. This effect is worsened the further away the actor is. I want a uniform pixelization, essentially I want the right edge to be pixelated the same as the left is.

This is using a basic UV pixelation effect through a lerp such as this:

Is this more of an issue of the type of effect being pushed to the stencil, as opposed to a problem with the way stencils work? Is it because of the way the UVs are being told to pixelate?
Is there a way to force the effect to have consistent pixelated boundaries all around the stencil?
Could I make the effect exceed the boundary of the depth stencil by a certain number of pixels? (artificially increase the visual silhouette of the stencil so the it properly covers the whole actor, pixelating some of the background with it) any other solutions?
I don’t want the smooth silhouette definition visible, only a uniform mosaic effect within, or even slightly outside of the boundaries of the depth layer.

Hope someone can help, thanks!