Search Unity

Graphics HXGI Realtime Dynamic GI

Discussion in 'Tools In Progress' started by Lexie, May 24, 2017.

  1. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    @Lexie Looks amazing, almost perfectly identical. Yours just need to be ever so slightly brighter, and I wouldn't be able to tell at all.
     
  2. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    We visualize things like ships and boats, and other constructed items which have very thin (and non-square) hulls, roofs, etc, and it's impossible for us to adher to any rules like "1 voxel thick walls". But so far, we haven't visualized anything as large as a landscape, and since HXGI apparently can do this, is it possible to scale down the size of the voxels to gain higher resolution fidelity in a smaller area?
     
  3. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    736
    I was wondering the same thing.
    If the cube size is .5 meters and I have a house wall that is 4 inches thick running thru the middle, how does the cube gather light information, if the outside is bright sun and the inside is dim.
    Its just one cube, so inside and outside surfaces of a wall model get some averaged value?

    Hmm, I seem to remember you were saving light data coming from each of the 6 directions.
    So maybe thats the answer. But I'm not sure your current version is doing that.
     
  4. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646

    You can set the voxel resolution to be what ever you want. voxels can be thicker then a wall, The data is calculated and stored anistropically so as long as only 1 major wall per axis exists in a voxel, its normally enough to represent the space.
     
    ekergraphics likes this.
  5. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Right, so this essentially means that wall thickness is not a factor (even walls with a thickness of zero could work?) in light bleeding because your system is conservative about that? So the thing that needs to be weighed against voxel size is how often unintentional light blocking & lack of bouncing occur?
     
  6. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Yep.
     
    one_one likes this.
  7. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I was able to get the chunk system working so now it supports any size volume. The below image uses a volume of (4,3,2) chunks that each have a 64^3 sparse voxel tree. This voxel scale is probably overkill for a game.



    If I was to add anistropic voxel data to my old Light Propagation Volumes, it would have used 864MB of VRAM for a volume of this size.
    The new Sparse voxel system gives much better results while only using 127MB of data. This will allow me to scale up to support the large levels we have in our game.
     
    Last edited: Dec 15, 2018
  8. Deleted User

    Deleted User

    Guest

    I have been following this thread with great enthusiasm for some time! I'm very impressed with your work and I was just wondering if you have an ETA on when this will be released. I understand that it's not finished but it appears to be more complete than SEGI. I guess I was hoping you could release an early version.
     
  9. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Perhaps the question is, if this will ever be released.....
     
  10. PhilippG

    PhilippG

    Joined:
    Jan 7, 2014
    Posts:
    257
    hopium
     
    SteveB likes this.
  11. kornel-l-varga

    kornel-l-varga

    Joined:
    Jan 18, 2013
    Posts:
    43
    Yeah, I think we all are eager to put our hands on this!
    For me it seems pretty crazy that Unity Devs. have not picked up on the vibe yet that fully realtime GI should be realized.
    If im not mistaken since 2013 there are attempts to achieve this in Unity, some of them got really close, while some other were just a scam (Livienda, SpectraGI... well I dont know if it ever was real), and 0.9 Nvidia VXGI has been accessable since 2015..
    6 years of drooling over this concept, and no plans on Unity's roadmap what so ever.. perhaps now that UE4 got it pretty decent...
    I mean its great that at least we have something thanks to Sonic Ether, and gosh if Lexie's work would hit the shelves, I would be extatic.. but I think Unity should at least consider the demand, even if it is an experimental adaptation of Nvidia's VXGI.. they have soo many incredible rogue geniuses all around the world.
     
  12. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    GI is dependent on good material rendering (which unity is leading at) also RT GI is either super limited or super expensive. I think UNITY choose the more practicable way, ie a workflow that will ship in game with decent performance. Ie basically LUT since you can't get faster than that (lppv, box projected cubemap, SH tetrahedron, lightmap).
     
  13. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    And why not semi-RT GI?
    All my scenes are generated at runtime, because modders can add/remove any object (even create a scene from scratch).
    It means that I cannot bake the GI using Unity tools.

    But, if it were possible to bake GI at runtime (maybe with level of details, but not necessarily), then it would become possible.
    When a mod is added or removed, then the game would compute lightmaps and store them. After that, it would be exactly as if GI would have been baked using the editor, same speed, etc.
     
    kornel-l-varga likes this.
  14. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Before this will be released, i think there will be entry affordable RTX 3D cards making real time GI option available in most 3D engines lol
     
  15. kornel-l-varga

    kornel-l-varga

    Joined:
    Jan 18, 2013
    Posts:
    43
    totally agree
     
  16. vb2s360

    vb2s360

    Joined:
    Oct 7, 2015
    Posts:
    34
    Yep. Time to monetize @Lexie :p

    Please. I'm so hyped :rolleyes:
     
    SteveB likes this.
  17. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    No hate, but this was announced so long time ago and still nothing out.
     
    Last edited: Feb 1, 2019
  18. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    The system is for their game, first and foremost. Lexie initially opened up this thread to catalog his process on a centralized place. He even said in the original post that he's "not sure yet if I will release this to the public or not since I don't know if I have the time to support another asset or if it's even financial worth my time". Never was it mentioned that this WILL get released (although there were talks of him releasing one of his older approaches).

    Lexie's latest work on the system was in December (https://twitter.com/hxLexie/status/1073740792986984449) and he's also playing with "2D GI" from time to time.

    Maybe plans have changed.
     
  19. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Yeah Lexie has been very clear all the way along, so I am not impressed by anyone who thinks its acceptable to call this vapourware.
     
    the_greenlig, Adam-Bailey and Tzan like this.
  20. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    I appreciate that it's totally his call whether or when to release it, but as one of the plebs it does feel a little bit like walking past a car showroom every day and they won't sell any to you until they've put the 11,000th coat of wax on. ;) From what I've heard it would cover 95% of what people need as-is.
     
  21. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    That 5% is a lot of support work though, so can't blame Lexie for not putting out an asset they don't have the time/resources to support like that.
     
    PatysTy and hopeful like this.
  22. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I've added a real denoiser pipeline, before I was relying on some extremely aggressive TAA which was causing a lot of ghosting if objects or the camera were in motion. This solution is temporally stable so it looks great in motion with no ghosting. I still have some work to do to clean it up though. My depth aware filtering needs some work and I still need to add support for half res rendering.



    Ill post a video once I've finished with the denoiser.

    Edit: Please note that finishing this GI is not my top priority for my team currently. We are in the middle of contract work to keep the lights on so updates my be sparse.
     
    Last edited: Feb 5, 2019
  23. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I've added support for 1/4 rays per pixel and improved the denoiser to support a sample count so low.

    Here are the timings at 1080p on a GTX 1070 at 1/4 rpp, these timings are for constructing the indirect buffer and applying it to the current frame. It runs at 145fps in the scene above

    upload_2019-2-5_19-5-45.png

    Its generally another 1ms to update one bounce worth of light in a chunk, the system updates one chunk per frame to keep the cost down. Chunks are stored in a 64^3 sparse octree volume.

    If a chunks voxel data needs to be updated, it takes around 1ms to update the data on the GPU. I should be able to spread this over 2 frames to improve performance.

    I still need to optimize the reporjection pass and make the effect handle de-occlusion better. I'll move onto reflections after that.
     
    DasBiot, Slaghton, ftejada and 8 others like this.
  24. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Just a little video showing some camera movement + scene changes.



    I'll post a better video later.
     
    DasBiot, Slaghton, Flurgle and 18 others like this.
  25. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    That really looks awesome...
     
  26. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
    What time can i by or get HXGi?
     
    S_Darkwell likes this.
  27. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
  28. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    I love watching the GI fill in. I know that's not suppose to be a feature, but it looks so cool :cool:
     
  29. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Yeah it doesn't look too bad even with large scene changes like the above video. There are some things I need to work on that will speed that process up a bit, I'm trying to update the GI on a separate render thread, this should hopfully speed up changes like the above.

    Keep in mind these objects were flagged to contribute to GI.Things like players and fast moving dynamic objects should normally only be lit by the GI. That way if they disappear like this, it doesn't effects the GI contribute.
     
  30. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Ooooh nice indirect shadow you got there. . .
     
  31. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    that video is quite impresive.
     
  32. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
  33. kornel-l-varga

    kornel-l-varga

    Joined:
    Jan 18, 2013
    Posts:
    43
    Apologies for the slightly off topic message!
    Does any of you know about a working and publicly accessible runtime GI lightmap builder for Unity? I believe Lexie has created one before, is there any plan to release that in any form?
     
  34. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi, @Lexie !

    I do not know if this can help you, but I found this open source engine and the license says: "The full source code is provided with the MIT license, which means, anyone is free to use it for anything without additional considerations. not contain any parts with other licensing ". The code I think this C ++
    From what I have seen in this video it has a realtime GI system. I do not understand much of the matter, but maybe I can help you for your GI system in realtime:


    Maybe you want to take a look, so I'll leave the GitHub link to download or inform you. https://github.com/turanszkij/WickedEngine

    A greeting.
     
    DasBiot and Flurgle like this.
  35. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    I'm pretty sure what lexis has is already superior to this. Tho that does look quite impressive!
     
    kornel-l-varga likes this.
  36. kornel-l-varga

    kornel-l-varga

    Joined:
    Jan 18, 2013
    Posts:
    43
    true, however after switching a couple of messages with the developer I have found out that he does have a path tracer light map generator in the opensource code on github. It is in C++ but perhaps that part could be somewhat less complicated to port to Unity than the whole VXGI system, for those who does only need a runtime lightmap bake system.
     
  37. macdude2

    macdude2

    Joined:
    Sep 22, 2010
    Posts:
    686
    I'm not sure of a need for offline baked maps if realtime GI is so fast anyway? Regardless, if offline maps were necessary for a game, it would probably be optimal to generate them on a server and then send them back to the client negating the need for such a general use offline lightmapper anyway.
     
  38. kornel-l-varga

    kornel-l-varga

    Joined:
    Jan 18, 2013
    Posts:
    43
    well some of us are not creating "games". and yes I agree with you if the real-realtime GI ( I mean something like the voxel based solutions or an amazing mixed-raytracing solution) would be accessable sure I would go for it. However at the moment there is no solution that would be fast enough for VR application nor exists (accessable to the public) any VR optimized one.
    So I am just looking at secondary options like runtime lightmap baking.
    Interesting what you said about the server-client bake solution, how would you approach it? (I mean if the server runs in Unity then it would also have to be able to bake lightmaps at Unity Runtime... or would you just upload the scene to some other lightmap baker send that back to Unity?)
    Just to make it clear why I need this.. in my project we are generating procedural meshes AND importing meshes from HDD at runtime for a VR final result... and while my heart is with any kind of VXGI.. I have to think about efficiency at the moment..
     
  39. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
    Excuse me, what is the solution of HXGI? VoxelConeTrace or other?
     
  40. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    It's hybrid method that combines the strengths of a bunch of different GI methods while removing most/all of their weaknesses, It uses a sparse anisotropic voxel 64-tree to store the world data and a sparse radiance/irradiance volume to store the lighting data. Still experimenting with the best way to sample the radiance/irradiance data.

    Right now I'm experimenting with a ray traced + denoising step to produce the final results, this method would limit it to 9 series equivalent hardware and above but the results are very close to baked lighting. I'll move onto sampling the sparse radiance data directly with interpolation next, this method should work on console level hardware and VR but the indirect lighting might look a little flat.
     
    Slaghton, macdude2, elbows and 3 others like this.
  41. CGBull

    CGBull

    Joined:
    Feb 12, 2017
    Posts:
    82
    This cool, Raytracing method is voxel ray trace?
     
  42. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I started a little thread about native true realtime GI in Unity, I invite you to join the discussion.
     
  43. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Interesting, My guess is RTX support announced at GDC. The talks and papers that break down the render process for those RTX demos still required some form of baked lightmaps/volumes anyway to calculate the incoming light at the rays hit point so it alone doesn't actually solve realtime GI.
     
  44. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Yep we still has to pay the brdf cost per hit, even with raytracing. I'm more interesting for when the rt hype died out and we start using it with smart and clever optimization for ANYthing. MY guess is early ACTUALLY practical stuff will be stuff like "it makes for a good random access of fragments to accelerate old GI solution like HxGI."
     
  45. imblue4d

    imblue4d

    Joined:
    May 27, 2016
    Posts:
    110
    I was thinking about exactly this when NVIDIA announced the RTX series! i really hope it will make voxel GI solutions more performant.

    Another thing: at the current time we cannot have raytraced reflections and GI at the same time (NVIDIA showcased raytraced GI and reflections on two different games for a reason), but with solutions like HxGI that could be possible before rt becomes mainstream
     
    Flurgle likes this.
  46. VCDESIGN

    VCDESIGN

    Joined:
    Jul 18, 2017
    Posts:
    43
    Do you plan to release HXGI This year? I'm really needing a solution like that for my game
     
  47. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    This looks like a good talk:


    Runs faster than 1ms apparently. Looks good.
     
    hippocoder, ftejada, PROE_ and 4 others like this.
  48. florianalexandru05

    florianalexandru05

    Joined:
    Mar 31, 2014
    Posts:
    1,806
    When will this be up?
     
  49. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    I'm guessing it will only be available on the GDC vault. It doesn't appear to be on there yet.
     
    florianalexandru05 likes this.
  50. Flurgle

    Flurgle

    Joined:
    May 16, 2016
    Posts:
    389
    Just found this: https://github.com/Looooong/Unity-SRP-VXGI

    Not sure if anyone here has seen it. It runs well, but works weirdly, like if you disable the VXGI, the entire scene tab goes black. Also, it looks like it uses msaa, and has custom shadows - all custom render pipeline.

    My screenshots:
    upload_2019-3-27_14-49-55.png


    upload_2019-3-27_14-51-0.png

    upload_2019-3-27_14-51-27.png

    upload_2019-3-27_14-53-34.png
     

    Attached Files:

    ivanmotta, Lex4art, Mauri and 2 others like this.