Search Unity

Better fake AA for deferred lighting

Discussion in 'Made With Unity' started by multivac, Oct 10, 2010.

  1. h20

    h20

    Joined:
    Dec 8, 2009
    Posts:
    50
    Pro 3.3
     
  2. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Did you import the "Image Effects (Pro Only) package?
     
  3. h20

    h20

    Joined:
    Dec 8, 2009
    Posts:
    50
    yes
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    You should have an image effect called "Edge Blur (Luminance)" (Component > Image Effects > Edge Blur (Luminance)). If you don't, re-import the standard asset package. If that doesn't work, re-start Unity. If that doesn't work, I'm stumped.
     
  5. h20

    h20

    Joined:
    Dec 8, 2009
    Posts:
    50
    thank you bigkahuna all is well.

    Small questiom: How come in Unity if i have a 3dsmax 2009 file he finds it but my max 2011 files don't work.

    Thanx
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    No idea. Try posting a new thread so a fellow Max user might see it.
     
  7. h20

    h20

    Joined:
    Dec 8, 2009
    Posts:
    50
    i'm in deferred lighting

    I'm using directionnal lights and spot lights.

    How come for the spot lights I can't get any soft shadows?

    thanx
     
  8. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    The official one really sucks.
    I tried every possible setting.
    Watched the edges carefully in black and white I managed to find what I consider the best setting: 15 for depth sensitivity and 1.2 or so for normal sensitivity.

    A single pixel line or at max two pixels, more is useless: it will blur ugly.
    Edge detect spread at 0.5 or 1, not more.

    Filter radius is not working under 0.75, no matter how high you raise the iterations.
    This looks like a problem with the precision of the blur effect.

    The iterations parameter is too heavy: raising it over 3 will heavily blur all the edges and make your scene dreamy. This is because you can't calibrate the blur radius parameter precisely.

    IMHO the blur filter should be executed by a far smaller amount with a higher number of iterations.

    But I have also an idea to make this filter work, if someone is interested in it just pm me.
     
    Last edited: Mar 23, 2011
  9. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Unity needs to just simply re write or fix deferred rendering, or even BETTER is that if deferred did NOT exist, really in unity 2.x you could use point light and shadows in forward and basically in any settings, deferred is really a crap addon... (no offence to UT) but they should really listen to the consumers, which is us, and im sure i speak for a lot of others that say they want the regular settings back...

    -shadows are TERRIBLE
    -no AA
    -luminance edge barely helps
    -possibilty of increased DCs

    The video I saw of deferred rendering when U3 came out was great, nothing compared to what we have right now...

    Megmaltese, if you end up making this filter work, lemme know, it will really help a lot. I kind of gave up with deferred rendering, ill see what happens.
     
    Last edited: Mar 23, 2011
  10. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Well I don't agree with your opinion on deferred: deferred rendering is definitely a great pipeline for artists.
    It allows them to create great suggestive environments by leaving them great freedom on lighting.
    I honestly prefer to have the freedom to create great looking environments by placing how many lights I want than to have AA, even if at the moment I feel the impact.

    For the rest:
    - shadows are surely not the best, they could be easily better
    - AA in deferred... well I consider it non-existing at the moment
    - luminance edge is a pastiche of no use, for the reasons I explained up above: there's no way to put it at really good use... it will blur too much in the wrong places and nothing in important places.

    I will not make the filter.
    I know the basis of programming and I programmed some stuff years ago but I left this task and I have no wish to go deep into shader language at all.
    But because I know the theory of engine and shaders and all I can say I have an idea that I think could be good to create some decent AA on deferred rendering.

    The idea is an addition to the actual filter. Nothing really incredible, just another full screen filter to apply before the blur effect but it must be tested.
    So, if someone has still any wish to go for some solution on this, just drop me a line and I'll try to explain what is this additional filter I'm thinking of.
     
  11. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Possibly... I guess pixel lights does definetly look better in deferred, and knowing that its not possible (from my knowledge) that AA cannot be included with deferred, I think all UT needs to do is just fix the shadows (if its possible) and it would be perfect. Playing around with the edge blur isn't too bad, but still doesn't beat 16x multi
     
  12. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    Having MSAA with Defferred rendering is a bit tricky and difficult to achieve on DX9. Only few litle engines currently supports MSAA with DX9 and defferred rendering. The one that i know is CryEngine3, not even Unreal Engine supports MSAA on DX9 (only DX11 version of UE). Infact, Unreal Engine do not support any defferred renderer on DX9, it's by default fordward rendering but they can still achieve to get tons of "fake dynamic" lights in a scene tanks to their pre-computed lighting system (using light grids and fancy interpolations between those). A similar pre-computed lightsing system that we'll see in Unity with lights probes. ;)
     
    Last edited: Mar 26, 2011
  13. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Well light probes are a direct consequence of the lightmapping stuff... they should have been implemented together IMHO.

    But apart that, Artimese, could you post your parameters for edge blur? You say it's not better than 16xAA but for what I achieved it's not better even than 4xAA...
     
  14. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Uhm i noticed that other image effects will destroy the look of edge blur such as contract and a few others. Clear your camera of all image effects and add on the edge blur. Then put the parameters to: Offset = 0.5 | Radius = 35. Im sure theres a better combination but i have not tried others, its about 4-6x depending on what slope the edge of a mesh is. I also noticed the further your away from a mesh with a texture, the more depth the normals will show, therefore blurrying the looks of it. If you find anythign better than this combination let me know
     
  15. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Those settings look way too blurry to my eye. I'm using offset scale @ 0.2 and blur radius @ 14 which seems to be the highest I can set those and still get a crisp looking image. I have to say, though, that it doesn't look as clean as I remember we had with 2.6. Not saying it's bad, just not as good (to my eye at least).
     
  16. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,368
    I'm using : Offset scale = 0.1 and blur radius 35.
    But to me, it blurs only a little bit and if get over 0.1, it starts to sharpen the edges instead of blurring.
     
  17. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @tatoforever - Good eye. I tried both our settings and had to blow up a still to see it, but I think I like your settings better than mine! ;)
     
  18. multivac

    multivac

    Joined:
    Oct 27, 2009
    Posts:
    133
    I have ported the shader to Unity 3.3, the link in the first post is updated.
    Mine is slightly more agressive in smoothing edges than Unity's and maybe a bit more accurate, because i don't use the vertex shader, but it pretty much comes down to taste and now you have both choices:)
     
  19. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    @multivac - Excellent, I'll have to give it a try. Although the Standard Asset AA is better than nothing, it's still not as good as AA was in 2.6. I'm looking forward to seeing how much better yours is.
     
  20. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    In 2.6 there wasn't deferred rendering system... that's why.
    If you go for forward rendering, you will still have that full nice AA at 16x, but that is hardware stuff and can't be used on deferred rendering.
     
  21. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Nice one! I like the results with this, cheers!
     
  22. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    I tried it but got an error.
     
  23. caesargao

    caesargao

    Joined:
    Dec 16, 2009
    Posts:
    19
    me either...got error when imported to project. any update? i am using unity 3.3
     
  24. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Hmph, nothing under 0.5 offset scale works, it looks the same as 0.5 :S
     
  25. flim

    flim

    Joined:
    Mar 22, 2008
    Posts:
    326
    I am using Unity 3.3 Pro, how to use that package? After import I got the error

    Assets/Standard Assets/Image Effects (Pro Only)/NFAA.js(7,20): BCE0018: The name 'PostEffectBase' does not denote a valid type ('not found').
     
  26. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Did you import the Image Effects Pro asset?
     
  27. flim

    flim

    Joined:
    Mar 22, 2008
    Posts:
    326
    The warning is gone after add the Image Effects Pro assets. But how to enable NFAA? I added the script to camera but not effect. Please help.
     
  28. tariq86

    tariq86

    Joined:
    Nov 25, 2010
    Posts:
    7
    i have a error on importing this package

    The name 'PostEffectsBase' does not denote a valid type ('not found').
     
  29. wannabeartist

    wannabeartist

    Joined:
    Jun 20, 2009
    Posts:
    272
    Hey,

    Awesome work - any tips on the sensitivity depth? How should I set it?
     
  30. Waz

    Waz

    Joined:
    May 1, 2010
    Posts:
    287
  31. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    What is this Edge Filter (Luminance) or Luminance Blur image effect everyone is talking about?
    I've got Pro and when I try to import the Image Effects it tells me they're all imported, but there is still no effect resembling anything like those names. I got Unity 3.4.2
     
  32. diOriginal

    diOriginal

    Joined:
    May 9, 2012
    Posts:
    7
    Hello

    I have the same problem.

    have anyone a soloution?

    i got Unity 3.5.1f2
     
  33. sotec

    sotec

    Joined:
    Sep 14, 2012
    Posts:
    34
    Hi guys, here come a solution :
    i'm now in unity 4.0 and there is a script to put on the camera called "AntialiasingAsPostEffect"
    there are 7 different script for deferred lightning.
    Choose the FXAA1presetA and u have an amasing AA

    have a good day :p

    Sotec

    EDIT : i'm in pro version, so i don't know if it is here under the free license, but i think i should .
     
  34. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664