Blurring certain stencil buffers for outlines

I’m trying to create/customise a material for multi-color soft outlines on meshes, but with my own specific set of occlusion rules and per-stencil settings.

I’m using Tom Looman’s Local Outlines as my base material. Its main selling point is the fact that it doesn’t use postprocessing, instead relying on translucent surrounding meshes, e.g. a cube or a sphere. This leads to some performance gains.

I’ve used the spiral blur HLSL code from here (courtesy of Zuzana Ferková), which in turn is based on this (by Tom Looman). The results are promising, however, I’m lacking the ability to choose, which stencils are affected by the blur. The code in question doesn’t discriminate between any stencil indexes and affects each and all of them.

How would I go about implementing a filter in order to affect only certain stencils? Any help would be appreciated!