Search Unity

Tackle Antialiasing in shaders?

Discussion in 'Shaders' started by eco_bach, Mar 2, 2017.

  1. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Watching this very intereresting Unite 16 talk by Zerolight and the speaker suggests optimizing antialiasing by doing it with shaders. This is new to me.


    Is anyone aware of any examples, on github or elsewhere, of anti aliasing accomplished via shader code?
     
  2. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,436
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    "Anti-aliasing in shaders" is a big topic with lots of different use cases and techniques for different situations. Post process based AA like FXAA, SMAA, or TAA could be considered full screen shader based AA. You can also do in shader super sampling when rendering surfaces (common for text rendering), or analytical approaches using distance fields (also common in text rendering). There's also several techniques involving special processing of normal maps and smoothness maps to do specular and diffuse anti-aliasing. And there's UV manipulation like RetroAA which is a very special case for reproducing the look of hard edged pixel art but maintaining the benefits of texture mip mapping and reducing aliasing.
     
    Last edited: Mar 2, 2017
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Watched the video. He's talking specifically about this paper:
    http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
    http://www.gdcvault.com/play/1021771/Advanced-VR

    There are a ton of different ways to pre-process your texture maps to get essentially free specular anti-aliasing, and the Valve approach is one of them. There's also CLEAN mapping, Toksvig AA, and precomputed vMF used in The Order 1886. That last link has a nice little demo application which you can toggle between several different specular AA techniques.

    The Alloy Physical Shader Framework asset for Unity I believe has the option to use precomputed Toksvig.
     
  5. eco_bach

    eco_bach

    Joined:
    Jul 8, 2013
    Posts:
    1,601
    Awesome info, thanks! Any idea if Alloy is useable on mobile(Android, OpenGLES2 or 3)?
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
  7. Deleted User

    Deleted User

    Guest

    @bgolus
    Slight correction. Alloy used to use Toksvig AA, but we switched to the approach used by "The Order" when we switched to using a GGX-based BRDF.
     
    bgolus likes this.
  8. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Awesome, I hadn't seen Alloy switched over to GGX & vMF.