Search Unity

NVIDIA HBAO+ Image Effect - Sample Project

Discussion in 'General Graphics' started by smb02dunnal, Feb 7, 2015.

  1. gratyanolteanu

    gratyanolteanu

    Joined:
    Nov 18, 2014
    Posts:
    24
    I Had downloaded 2.3, if now is 2.4 I need to Download.
    If I remeber the GFSDK_HBAO_distro_r2.3 was made for Unity 4+
    So. If you want to use the x32(86) Version in unity 5 You need to Recompile The shaders that is in the example.
    See my other post.
    Then if you want The plugin for unity 5 x64 You need The lib folder , include folder and plugin source folder
    You need to download everything. And find x64 libraries.
    Then Follow the above steps in order to compile the plugin for x64.
    After Compilation, If you want the bouth x32 an x64 you need to Chage the name of the new plugin,
    Copy the HBAO_Plugin
    Rename it to HBAO_Plugin64
    and the name of the script to HBAOPlus64
    And in the script (HBAOPlus64) you need to change some line of code for script to call the new name of the plugin
    If not, Delete the x32 one and keep the x64 one with the same name
    See my video.!
    And my steps abobe.!
     
    ksam2 likes this.
  2. gratyanolteanu

    gratyanolteanu

    Joined:
    Nov 18, 2014
    Posts:
    24
    I think they removed the GFSDK_HBAO_distro_r2.3_cl18967762 which contained library for x64

    and now The GFSDK_HBAO+_distro_r2.4_cl19426158 is the source. Without unity sample.
    So
    In 2.4 You will find a folder Called lib. In this folder are de Dll and the libraries for x32(86) and x64
    The dll need to be in Unity project root
    But first copy those Dll and lib files in lib folder where is 2.3 lib folder
    You can use GFSDK_SSAO.h from 2.4 lib folder if you want and overwrite the old one witch is in include folder.
    Now. in hbao_r2.3 You have a folder called unity with 2 folder . One folder called plugin and other is the uniy sample scene for unity 4.6 I think.

    In Plugin folder you have the source code VS2012 and in that folder is the HBAO_Plugin.sln ....
    Open HBAO_Plugin.sln in VS. and follows my steps from above...
     
    ksam2 likes this.
  3. matmuze

    matmuze

    Joined:
    Jan 14, 2014
    Posts:
    27
    Question to smb02dunnalI:

    Instead of using the registers hack why not simply use a Blit to fetch the depth from unity to a RenderTexture and simply passing the handle to the plugin ?
     
    Last edited: May 5, 2015
  4. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Thanks man. please try to fix it for Unity5.
     
  5. matmuze

    matmuze

    Joined:
    Jan 14, 2014
    Posts:
    27
  6. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    @matmuze
    That's against their EULA , they don't want their stuff shared outside their website , just keep the stuff you made, remove the dll,libs and sources that belong to NVIDIA.

    And by the way , is there anyway you can try to pass the normals data (i used the depthnormals texture and also i tried using the gBuffer's normals) , i tried once but it came up with a mess (same for both) , probably because unity's camera view matrices are different than what HBAO+ expects...
     
    Last edited: May 5, 2015
  7. matmuze

    matmuze

    Joined:
    Jan 14, 2014
    Posts:
    27
    The normals from unity are either in world space, in the case of deferred rendering or view space in the standard depthnormals buffer.

    If the deferred normals did not work it might mean that your must convert to it view space, which is trivial to do in a simple blit operation.

    In direct rendering mode the depth and normals are encripted together in the rgba channels, on way would be to blit the depthnormals buffer as I did in the sample and to decode the normal during the process, once you are done you can simply pass it to HBAO if you are not scared of getting your hands dirty with native plugin coding.

    It is not so hard to achieve really, let me know if you need help.
     
  8. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    So , I should make a shader that multiplies the World Space normals by the Camera View Matrix , Then do the same thing you did to pass the depth?
     
  9. DennG

    DennG

    Joined:
    Dec 5, 2013
    Posts:
    158
    What's with the licensing. Can we use it in commercial projects?
     
    minhdaubu2 likes this.
  10. zelmund

    zelmund

    Joined:
    Mar 2, 2012
    Posts:
    377
    when turn on forward and 8x antialiasing camera fliping on vertical. how to fix that?
     
  11. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    557
    I am also having the flip anti-aliasing issue.
     
  12. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    Just invert the output in the shader code
     
  13. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    557
    I ended up deleting the project because when Imported into a new project I kept getting the HBAO Plugin DLL Not found error.
     
  14. Deleted User

    Deleted User

    Guest

    All works fine in Unity 5 editor window , but I tried make standalone build of your demo. I opened executable file and I have got black screen (*.dll files are included in build). How can I use HBAO effect in my standalone Win64 DirectX11 build ???
     
    minhdaubu2 likes this.
  15. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    69
    Similar question.
     
  16. TrollHachem

    TrollHachem

    Joined:
    Dec 25, 2012
    Posts:
    65
    From NVIDIA Gameworks EULA at : https://developer.nvidia.com/gameworks-sdk-eula

     
    ruxavik and minhdaubu2 like this.
  17. art_craft_vlad

    art_craft_vlad

    Joined:
    May 26, 2015
    Posts:
    8
    We just upgraded to Unity 5.1.1 and start getting "Failed to load 'Assets/Plugins/HBAO_Plugin.x64.dll' with error 'The operation completed successfully. ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly." errors.
    5.0 had not had that issue either. I had not tried to rebuild the DLL yet, though.

    On the side note, before we get to that, I had to fix the DLL name setup part where it was checking #if UNITY_5_0, cause obviously Unity 5.1.1 has a different define. I did not find any UNITY_5 defines, which would work for all 5.X.X, but that is a separate issue.
     
    nxrighthere and minhdaubu2 like this.
  18. art_craft_vlad

    art_craft_vlad

    Joined:
    May 26, 2015
    Posts:
    8
    Ok, I tried to rebuild the project wit VS2013. New Release x64 DLL is 1K smaller than the on included in the original package. However, the error still stays.
    I have found that some other plugins had the similar issue and the posted on their forums "The problem seems to be related to a VC++ dependency which is missing on some systems. This doesn't explain why the problem only presents itself in Unity 5.1 though so I'm not entirely sure.". However, there was no indication what was that problem and how to solve it.

    Anyone knows what is all that about?
     
  19. minhdaubu2

    minhdaubu2

    Joined:
    Jun 10, 2014
    Posts:
    69
    Yeah the build doesn't work. It end up with a lot of error "DLLNotFoundException.....' Please help
     
  20. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    I'm getting this too and I'm absolutely perplexed by it.
     
  21. mittense

    mittense

    Joined:
    Jul 25, 2013
    Posts:
    168
    Just needed to toss the GFSDK_SSAO DLLs into the base project directory.
     
    minhdaubu2 likes this.
  22. art_craft_vlad

    art_craft_vlad

    Joined:
    May 26, 2015
    Posts:
    8
    Thanks, Trent.
    Apparently the location of DLL is expected differently depending whether you run in the editor or standalone build. Editor wants GFSDK_SSAO DLL in Plugins; standalone build - in main folder, next to EXE.
     
    minhdaubu2 likes this.
  23. svaldenegro

    svaldenegro

    Joined:
    Feb 22, 2014
    Posts:
    25
    Someone has fixed it?!!
     
  24. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    just go to the HBAO+ page on the gameworks website they have samples for unity, i think its the same as here and it contains both x86 and x64 with source code
     
  25. alelordelo

    alelordelo

    Joined:
    Aug 3, 2015
    Posts:
    17
    Hey guys, was anyone successful in doing this for Flex?
    https://developer.nvidia.com/flex

    If not, would it be possible to use Flex in Unity, without having to write a C++ wrapper for Unity to flex?
     
  26. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    736
    You're going to have to write a wrapper.
     
  27. shubniggurath

    shubniggurath

    Joined:
    May 10, 2015
    Posts:
    10
    Hi, I have the following problem when trying to use the DLL
    "Failed to load 'Assets/Plugins/HBAO_Plugin.x64.dll' with error 'The operation completed successfully . ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly."
    I'm new using DLL and have no idea what is wrong , help.
    thanks
     
  28. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    57
    It seems hbao sample from Nvidia works fine after changing #if UNITY_5_0 string to #if UNITY_5 in HBAOPlus.cs despite on error
    Just restart the editor and check there is two GFSDK_SSAO dlls in the root folder of your project.
    Also you'd need these dlls in the root folder of your standalone build near the executable.
     
  29. Reaven99

    Reaven99

    Joined:
    Oct 3, 2015
    Posts:
    39
    Hello,

    I am getting a black screen [ fading into black once turned off and on ] once i use the HBAO+ in a windows build.
    It does work in the Editor without any problems.

    Does anyone have a fix fo this? or a tutorial of some sort on how to fix it so i can use HBAO+ in a build?

    Thanks in advance, Regards.
     
    lka69 and Pio98 like this.
  30. ashleyjlive

    ashleyjlive

    Joined:
    Oct 5, 2013
    Posts:
    11
    You might want to fix the warning where you use GL.IssuePluginEvent(eventId) as it is now deprecated in newer releases of unity.
     
    shkar-noori likes this.
  31. Pio98

    Pio98

    Joined:
    Jun 14, 2014
    Posts:
    7


    Same problem here. How should I fix it? How should I update 'GL.IssuePluginEvent(eventId)' to 'GL.IssuePlugonEvent(callback, eventId)'?

    Thanks in advice.
     
  32. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    IssuePluginEvent(eventID) is not used anymore, any updates to this package?
     
  33. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    368
    Does anyone have an updated binary?