Combine OutlinePass and multisampled WebGLRenderTarget

Hello, by using multisampled render target for EffectComposer my scene renders really nice… except for the OutlinePass, which has no anti aliasing at all (see screenshot below). I tried adding SMAAPass and/or FXAAPass after OutlinePass - both working together with N8AO ambient occlusion. The highlighting from OutlinePass then looks good, but other geometry worse, especially the thin white lines.

Question: Can OutlinePass somehow benefit from multisampling? Or is it possible to apply antialias pass only to OutlinePass? Are there a alternative solution to OutlinePass that also outlines hidden geometry like this but with an antialias technique? It is an animated scene with many elements so performance is also important.

1 Like

It looks like outlinepass creates a bunch of rendertargets internally.. perhaps you can change/adjust the resolution parameters you pass in to use a higher rez target?

( Or just copy the whole file and modify it if that’s easier )

Thanks for your answer! I tried to increase the resolution as OutlinePass parameter, but can’t see any difference. Does it make sense to overload the OutlinePass in order to set the samples option of one or all of the 7 WebGLRenderTargets?

Hmm i looked again and, what about changing:

	this.downSampleRatio = 2;

to 1?

.. and if not that.. then try setting .samples on all the targets?

just spitballing…

Tried this already, outline gets thinner, but anti alias unaffected. I will play around with the sampling parameter…

1 Like

I’ll just throw this out there as well.. I wrote/ported this implementation of the jumpflood algorithm for drawing outlines. It’s a completely different technique with its own quirks, but you get a lot more/different control of the kinds of outlines generated.

https://manthrax.github.io/jumpflood/index.html

4 Likes

Oh, this looks interesting, thanks for sharing! What I also found out in the meanwhile: The OutlinePass from pmndrs/postprocessing supports multisampling via parameter of the same name.

1 Like

ahh good catch!