Feedback for Epic on using Stencil for outline colors when outlining objects in a post-process shader:
I’ve just tried the newly added CustomStencil feature to control the outline color when outlining objects. This works! It wasn’t even hard to get going.
There wasn’t any documentation I could find about the best way to go about this, so I rolled my own as follows: I used a little 64x1 nearest-neighbor-filtered texture to read the outline colors, and indexed into that texture with the stencil value + a small bias to hit the pixel centers. Worked great, but this does point out the lack of material support for parameter value arrays (e.g, what would be a uniform float or vecN array in GLSL). You can kinda-sorta make do using textures as I did, but they are less convenient to write to from the CPU, a bit heavier weight for the GPU due to the filtering stages, and require converting the stencil value to a [0…1] range coordinate in the material.
Also, it would be really handy to have at least per-material control over the stencil value. Per object is a coarse knob.
Anyway, thanks for adding this in 4.9. It got me just the effect I wanted. I figured whoever implemented it might want to know how it worked in the real world.