Reducing the fidelity of an outline post process material.

I am using an outline post process. It’s pretty straight forward. I have some parameters I use to dampen out the smaller lines a bit and do a fade out over distance.

I do the standard SceneDepth difference to the pixel up, down, left, and right and add that up and do a multiply and another multiply by the depth fade and a clamp. Nothing really weird.

Here is an example of the outline. Larger objects like buildings are great but it would be nice if the palm outline wasn’t so detailed and the grass was ignored altogether. Thoughts?

(ignore the cropped parts :slight_smile: )

Here is the way I get the scene depth difference, this is for the pixel below, I just change the float 2 to get left, right, and up as expected. I add all 4 together and get outlines. Anything I could do to ignore smaller objects or just make the fidelity worse? I thought about using a Gaussian blur but that seemed really excessive. Maybe doing some kind of logic where if 3 or more directions are positive then I ignore it?

I did one thing, I multiplied the scene depth by a parameter and used it as a cutoff value to be compared against the sum of scene depth differences which draw the lines. This means that if something isn’t far enough away from the thing behind it then it won’t draw the outline.

This works pretty well but still gives a good amount of detail in a lot of things. Also when you are very close to something the outlines don’t show up as much as desired. It is a pretty good compromise though.

Perhaps you could enable CustomDepth only on the objects that you want to have outlines - then use that in your shader rather than SceneDepth? You could also use the CustomStencil setup to apply unique line thicknesses / settings per-object.

I do want to outline just about everything though. I guess I could set a custom stencil for things I don’t want like all the grass meshes so that foliage shouldn’t be picked up. It wouldn’t totally solve the problem of the over detail though.

I may try a gaussian blur of the scene depth and see how that does.