I tested your idea, you are right.
“blurring rgb with black background” is just really similar to “bleed rgb and then multiply blurry alpha”.
the changes I made accroding to your idea:
(1)changed the pingpong pass from “bleed rgb & blur a” → “just blur rgba together”
(2)changed the final composite pass from “straight alpha blend (Blend SrcAlpha OneMinusSrcAlpha)”
to “premultiplied blend (Blend One OneMinusSrcAlpha)”
the result is good.
but there is a new problem, It only works if I write alpha as 1 when doing replacement shader rendering
after the edit, reduce the alpha value will not fade out the outline, but instead, make it glow more.
red outline object write(1,0,0,1) to outline RenderTexture when doing replacement shading
the result is correct.
but when I write (1,0,0,0.5), in the past, I could make the outline fadeout 50%.
now it just glow more.
when set alpha to 0, in the past, outline will disappear completely.
but after the edit, it just stays and glow more
this is the method I use in final composite pass,
//use when blur rgba in pingpong, it means bloom's rgb was pre-multiplied by alpha
//col = scene original color
//bloom = the RenderTexture of pingpong's result
col.rgb = col.rgb * (1-bloom.a) + bloom.rgb;
is it an expected behavior or maybe I did something wrong?
The reason why setting the outline alpha to zero will not fadeout the outline but make it glow more, is because when alpha is 0, final composite pass output “original scene color + whatever in the outline rendertexture’s rgb”.(so it make sense why setting outline alpha to 0,make it glow more.)
[a little fix after the above edit accroding to your idea]
Maybe I should pre multiply the alpha to the rgb before the pingpong blur start?
-I did this, I can fadeout outline now, it is 100% correct when alpha is 0 or 1, but setting alpha between 0~1 is not exactly correct(it seems the color is darken when alpha is 0.5, currently no idea how to improve this)