Search Unity

Transparent background and Anti-Aliasing, especially SMAA

Discussion in 'WebGL' started by uwdlg, Mar 6, 2021.

  1. uwdlg


    Jan 16, 2017

    using this "hack-ish" method, I can successfully build WebGL builds without a background (to have other DOM elements show through transparent parts). I would like to enable Anti-Aliasing as well, and - aside from MSAA which I'm a bit unsure about in terms of resource demands - the Post Processing variants FXAA and SMAA don't work, because turning on Post Processing effectively removes the alpha channel (see the resolution note here: Issue 1193599). Is there some way to keep the alpha information with Post Processing enabled?
    I found a github repo "copying _CameraColorTexture alpha to _AfterPostProcessTexture via CustomRenderPass", but I think that takes the aliased alpha channel and applies it to the anti-aliased Post Processing result which isn't optimal.

    Also, I stumbled across another issue (1318214) about SMAA not working in WebGL and since I couldn't find a reference to it anywhere, I would like to enquire about this problem as well / direct attention to it, as I presume that SMAA would be more performance-friendly than MSAA if the transparency problem is solvable. FXAA isn't great for my case as it makes text on textures look bad.

    Of course other ways to get a mix of AA and background transparency to work in WebGL would be very welcome as well, thank you!