Search Unity

Transprency with noise?

Discussion in 'General Graphics' started by Cactus_on_Fire, Jul 29, 2020.

  1. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I'm working on a volumetric explosion shader and for it to work properly it needs to be opaque and use cutout for an accurate Zwrite. So instead of transparency I use noise to fade it out.
    Is there a technique for denoising this kind of stuff to make it look more transparent?

     
    adamgolden and richardkettlewell like this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Denoising is a giant ball of yarn to unravel and an ongoing area of significant research as things like mobile XR and ray tracing become a thing where inferring an image from sparse data is useful.

    On the low end you have something like FXAA, which can do a surprisingly good job of getting rid of noise... because it basically just blurs the frak out of everything.

    Next step above that would be to use TAA, which is basically a more complex and expensive way to blur the frak out of everything. (But it's how basically all AAA games deal with the problem.)

    Then you get to the more "real" denoisers, like Nvidia OptiX or Intel Open Image Denoise, but these generally aren't really intended for real time usage (though OptiX can be). Or something like Nvidia DLSS, or the really insane neural reconstruction stuff Facebook is working on. Those are all honestly probably outside any realistic real time use case, especially since a lot of it isn't fully public or doesn't work with Unity.


    The other side of things is make your noise look less like noise. Use blue noise instead of a white noise. And/or use MSAA and alpha to coverage.
     
    Last edited: Jul 29, 2020
  3. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    I used TAA in the video which helps to a degree but it creates more subtle noise and the inevitable ghosting effect. Also I have to assume the game or player might not choose TAA for anti aliasing. Another method is to use additional passes to fast blur the noisy areas which blurs the background too and is more costly since it works per mesh.

    Would you know how Stochastic SSR solves their noise problem? I know their denoising is only a different type of temporal frame blending based sampling but the realtime Unity implementations look amazing. This type of solution would do wonders.


     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    They're using a temporal reprojection for the reflection texture ... aka they're doing a forced TAA that you can't turn off. If you move the camera or something in the scene moves quickly, it'll be super noisy. It takes a few frames to clear up.

    I'd recommend you look at using blue noise or interleaved gradient noise. You might be surprised by how much cleaner it looks just by not using white noise.
     
  5. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Interesting result with blue noise :) I switched from spherical meshes to stacked planes so I'm not restrained by the vertex offset resolution anymore for smoke details. Strangely the FPS increased as well. This one does not use any kind of anti-aliasing and the blue noise is doing a good job. I'll see if I can switch the blue noise from screenspace to UV space without losing FPS.

     
    richardkettlewell and adamgolden like this.
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    It's amusing we have gone full circle to stipple transparency.

    Anyway, I remember some games using tricks like having the stippled meshes write into the stencil buffer so a post-process effect denoiser (usually a slightly smarter blur) could be applied on those pixels and the ones surrounding them.