OutlinePass with transparent sprites

Hi,

I’m using OutlinePass in my project. It works great with solid geometry. However, in my scene I also have partially transparent sprites, which may cover a significant part of the screen. Unfortunately the transparency is not taken into account, and objects that are “hidden” behind that transparent part have dimmer outline, which looks strange.

I tried removing the object.isSprite condition from VisibilityChangeCallBack and I noticed that sprites receive a standard rectangular outline. What I would expect here is outline in a shape of the actual image, without the transparent part.

I also tried setting NormalBlending and adding alphaTest to the depthMaterial, but nothing changes unless the value is greater than 1 (then of course nothing is rendered to the depth buffer and all outline gets visibleEdgeColor).

I think the whole problem is because when overriding DepthMaterial for the whole scene, the textures are not used at all. I even tried adding a line material.map = renderItem.material.map; after material is overriden in the renderObjects function, but to no avail. Is there any way to solve this?

Hi Adam,

Yeah, I didn’t take care of the transparent objects, and since the depth comparison is made to check the hidden edges(and color them), you see this issue. If the depth is discarded for those parts, it should work, as you did using alpha test. I will try to take a look at it

Maybe related: