Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

SEGI (Fully Dynamic Global Illumination)

Discussion in 'Assets and Asset Store' started by sonicether, Jun 10, 2016.

  1. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210
    Uhm, current Unity GI does not "run" at all, you need to compute it before playing.
     
  2. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    This is interesting


    @SebLagarde could you improve SEGI with this and bring into Unity 2018.3
     
    Last edited: Jun 24, 2018
  3. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    That's HxGI by @Lexie
     
  4. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,106
    I have to say that some sort of VXGI solution for HDRP is a must at this point...
     
  5. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Abuthar likes this.
  6. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    506
    Please someone make it to work with the Unity 2018.2.1f1 :(

    I get this error.
    Thread group size must be above zero
    UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    SEGI:OnPreRender() (at Assets/SEGI/SEGI.cs:979)
     
    Last edited: Aug 2, 2018
  7. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    506
    Weird it works when Voxel resolution is high but when I set it to Low resolution I get error! Anybody know why?
     
  8. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    How is performance when you set Voxel resolution is high?
     
    Crossway likes this.
  9. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    506
    Performance is bad when I set Voxel Resolution to high. But with Low resolution it's a lot better.
     
  10. Thibaud_SERRE

    Thibaud_SERRE

    Joined:
    Jun 15, 2017
    Posts:
    4
    Am I the only one having issue with Skinned mesh shadows ? I just tried to put Ethan inside my test scene and the shadow is just ... like big circle flickering around is feet, the size of the circle depending of the voxel space size. The only way to have a decent shadow is going as low as 7 (so the box is reaaaally small) on this gif the result is with the value at 30
     
  11. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    You're not. I tried it a while ago and got all sorts of weird shadow. I don't know how to solve it.
     
  12. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    You can put character to a layer that SEGI didn't see, attach an capsule to the character prefab, put this capsule to SEGI-only visible layer and receive an character shadow approximation from it.
     
    Thibaud_SERRE and konsic like this.
  13. sadicus

    sadicus

    Joined:
    Jan 28, 2012
    Posts:
    271
    Is this still being developed?
     
  14. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    825
    Well its open source but the creator dropped it like a hot potato. I feel like nvidia's big push for raytracing and the prospect of raytraced gi as well as the upcoming hdrp means this project is just dead in the water.
     
  15. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    they will complementary, raytracing won't solve everything
     
  16. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    612
    at the core I believe nvidia's RTX & directx' DXR provide an api for BVH traversal and ray-triangle intersections, both of which could be used in a global illumination implementation but not so much a voxel based one.

    I guess using the hardware accelerated intersections/traversal and coarse approximate geometry would make GI at interactive framerate work. It sounds more reasonable then raytracing reflections of high poly things on mirror things.
     
  17. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    Think of it like it, you could kick start non the voxel gi by sampling using a precompute of the starting ray with the raytrace. Especially for sparse voxel.

    Voxel have the adventage of low spatial frequency, ie it's better than noisy ray, so once you figure out all your ray intersection, you end with the voxel structure. Using the raytrace as a skip ahead of incoherent data toward coherent data.

    It would also help with light leak, by helping voxel sorting what they are bad at approximating: geometry.
     
  18. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    What is the difference between voxel illumination and raytracing ?
     
  19. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    The support format and the type of result,
    - voxel tend to be blurry (interpolated sample), raytrace tend to be noisy (single point).
    - Voxel capture low frequency easily, raytrace capture high frequency.
    - Voxel are an array (volume image), raytrace tend to use tree (bhv).
    - Raytracing does analytic intersection of primitive, voxel use raymarching in the array.
     
    konsic likes this.
  20. cerrec

    cerrec

    Joined:
    Jan 19, 2017
    Posts:
    41
    Can anyone tell me what's the last version of Unity that SEGI works with? I just tried it on 2018.2.2f1 and it doesn't work.

    Thanks.
     
  21. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    My fork and CK's fork it's forked from both work.

    https://github.com/ninlilizi/SEGI

    Also, my fork has experimental support for Single Pass Stereo (Shameless plug)
     
  22. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Can SEGI be merged with progressive lightmapper as unified GI solution ?

    Thank you @Ninlilizi for continuation of this project.
     
  23. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    It won't, they don't solve the same problem at all.
     
  24. cerrec

    cerrec

    Joined:
    Jan 19, 2017
    Posts:
    41
    I tried the CK fork of SEGI in Unity 2018.2.7. It works for new projects. However, when I brought in a project that was created in 2017.1 I get an error "Please fix compile errors before creating new script components". I have no idea what to do. Can anyone offer some guidance.

    Thanks!
     
    Last edited: Sep 13, 2018
  25. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    if you've compile errors... they usually appear in the console with a little red warning sign above the error telling you to fix the error..... and clearing the console doesn't clear out compile errors... So they stay there till you fix them. Click clear and see what remains... That's what the problem is.

    If you can paste the stacktrace from the errors above said fix the errors. I'll advise :)

    In other news, my fork now works in non-VR mode again as of a few hours ago. So feel free to try that too. I've been quite busy at it over the last week and intend to maintain it longer term as I'm working on a slow burn procedural world thing that I expect to take me a few more years to complete.
     
    Shinyclef likes this.
  26. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,657
    What are the differences between sonicether's last SEGI build and your current custom SEGI build - apart from the added Single Pass Stereo stuff?
     
  27. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Right now... CK's focuses on 2018 support and performance tweaks.... The volumetric shadow cam thing is a good example

    Mine right now primarily adds support for SPS... That's my own primary use case... But going forward I'm going to be focusing on performance and extra configurability... Because I enjoy a challenge. Sonic very much cared about fidelity, and was reluctant to sacrifice it for performance. I plan to go in a different direction there. Maintain the shiny mode SE perfected, but add in some deadrekoned options. My own artistic style will bias me towards stuff that works for more styalized art than photorealism.

    First couple of things added... An enhanced GI subsampling slider, that when at level 3 and 4 also substitutes the bilateral blur for a gaussian filter, as that gives a more aesthetically pleasing look at higher levels of subsampling. The trade off here is the texture sampling loop in the raytracer is a major performance penalty in testing. So that's helps when your metal is against the wall.. To compliment this, I've also added a tuner for the tracers noise coherency.. As the highfrequency noise that is acceptable to look at when running 1:1 gets really ugly and shimmery once you start subsampling... Turning that all the way gives blockier results. But if your not going for photorealism and instead more low-poly, flatshaded or similar stylized options. It actually kinda works, aesthetically speaking. Also, turning the noise filter all the way down into flat shading style output also gives a modest performance bonus. I'm using Voxel Farm in my project for my world building... So for a reference, that's my motivation... I've got a couple of profiles as examples.... The standard PC High quality settings..... And a 'VR' profile, which aside from the VR implication, gives is an example of pleasing results while taking advantage of these extra options I've added.

    Edit:
    As of now I have working reflections/specular tracing which the CK fork does not.
     
    Last edited: Sep 14, 2018
    Shinyclef and Lex4art like this.
  28. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Here's an example of the current quality of the 4x downsampled GI mode:
    This is with a GTX1060, and the scene has no lighting data.

    On:
    https://www.dropbox.com/s/h2k3vafomg3yswd/on.png?dl=0

    Off:
    https://www.dropbox.com/s/kgc31ht1l1ufhwg/off.png?dl=0

    Here,s another example of a typical scene (from a random asset pack)

    On:
    https://www.dropbox.com/s/i08oiy44ktfwa1b/ON2.png?dl=0

    Off:
    https://www.dropbox.com/s/xpae4ddezao58y0/Off2.png?dl=0

    Which shows we can still archive nice looking results at the bottom end of the fidelity/performance triage.
     
    Last edited: Sep 14, 2018
    Shinyclef likes this.
  29. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,469
    While we are at it, do you think segi's output can be cached using and onto texture rendering?
     
  30. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Depends on what you plan to do with the cached data.
     
    Shinyclef likes this.
  31. cerrec

    cerrec

    Joined:
    Jan 19, 2017
    Posts:
    41
    @Ninlilizi Thanks for your help. Following your procedure, I was able to track down the culprit. Turns out it had nothing to do with SEGI.One nice thing about Unity 2018 is I'm getting 2 frames per second better performance than Unity 2017, for the identical scene.

    @neoshaman Don't know if this will help you, but in Main Configuration if you uncheck 'Update GI' after you enter game mode, it's sort of like freezing SEGI's work. Caching, if you will. You will definitely get a bump in performance.
     
  32. Tenebris_Lab

    Tenebris_Lab

    Joined:
    May 23, 2017
    Posts:
    35

    Does this include Forward rendering because it seems to be broken with SPS in Forward mode...
     
  33. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Still Deferred only at this point in time. I will look into adding some level of forward rendering support.

    Edit:
    Working on Forward rendering now... Just wragling with the specular mapping.
     
    Last edited: Sep 14, 2018
    Shinyclef likes this.
  34. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Horrah!

    We now have Forward rendering support.... You loose some visual fidelity switching to forward. And the reflection tracing won't work with it... yet.... It's workable being the important thing ^_^

    If your running in forward, give SPS/Instanced mode a go... It's speedy.
     
  35. cerrec

    cerrec

    Joined:
    Jan 19, 2017
    Posts:
    41
    What are the advantages of using forward rendering for non SPS?
     
  36. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Forward rendering enables the use of MSAA Antialisasing... Which is a big deal to the VR crowd.

    If your not doing VR, you don't need to run in Forward. The downside to it, is slightly lower visual fidelity in the resulting GI.
     
    Shinyclef likes this.
  37. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    605
    Forward rendering also supports object transparency/translucency.
     
    one_one likes this.
  38. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    My first stable release suitable for actual use is now ready https://github.com/ninlilizi/SEGI/releases/tag/v0.9.1

    This release has feature complete support for both SPS and Forward rendering. Along with a pleathora of changes and optimizations.

    There is limited support for SP/Instanced rendering... It 'works', but currently lacks a number of features.
     
  39. scheichs

    scheichs

    Joined:
    Sep 7, 2013
    Posts:
    73
    Wow! That could make SEGI finally worth for VR development. Thanks a lot for the effort. Need to try it out ASAP!
     
  40. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,145
    Hi, i am surprised to see someone is doing a work on SEGI. What is the recommended Unity version to test it with !?
     
  41. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    I'm using 2018.2

    It 'should' also run on 2017.x ... But I haven't explicitly tested it there. If you encounter any issues, file them on my GitHub and I'd be more than happy to look into it.

    Consider 2017.x the minimum I'm willing the support

    Your welcome ^_^ .... Procedural VR use is my primary motivation. Now I've got a functional implementation for my next release I'll focus on performance.
     
    elbows likes this.
  42. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    I've had a request for a Demo scene. Something I'd not considered. So I will supply one when I get a moment.
     
    arzezniczak likes this.
  43. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,145
    Would be cool !

    I tried it first in the new 2018.3.0 b1
    - I had to import Post Process Stack and also switch from .NET 2.0 Subset to .NET 4.x Compatibility level to get rid of all errors.

    Then i made a new project in 2018.2.6 ( only other 2018 i had ) and i only had to include post processing package withot needing to switch the .API Compatibility Level to .NET 4.x

    However i couldn't make it run - i.e. getting proper GI.

    So it would be cool to get some test scene also !

    P.S. - also the camera in the scene coming with any newly created project has the "Default" tag instead of the "Main Camera" and i got a message to switch the camera tag to "Main Camera". However i still was getting the error after i switched the camera tag. Plus i got some Index Out Of Bounds errors but i am not sure now what it was about ! Will have to test again later !

    Cheers !
     
    Last edited: Sep 19, 2018
  44. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Oh wow... This is embarassing..... My bad.... The bilateral blur function appears to be broken everywhere but my own test scene I've been using.

    I'll fix that and push a new release with an included demo scene... Sorry guys :)
     
    N00MKRAD and Vagabond_ like this.
  45. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,145
    Thanks :)
     
  46. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    All done. Bug fixed and 2 demo scenes added. I ported the original low-poly scene and threw together a sexier scene from the Sponza Atrium model.

    https://github.com/ninlilizi/SEGI/releases/tag/v0.9.2

    If anyone's wondering why there's currently a PostEffect Stack dependency. It's because I'm in the process adding SRP support (don't get excited yet. Got a learning curve and a massive refactoring ahead of me before that dream becomes a reality)

    * Known Issues

    SP/Instanced mode is still a work in progress. Adding Forward renderpath support was a complex problem to solve, as SEGI approximates a lot of stuff using data from the gbuffers, which are not a thing in forward so had to devise an alternate solution (Which I can and will improve on over time)... This new method of approximation appears to not work out the box for Instanced rendering, I need to further examine the situation there.

    The toggle to visualise voxels doesn't work atm. That merely cosmetic as the voxelization is functioning normally.

    Color saturation. It's lower than ideal. I plan to add some pre-process colour grading functionality to make this user tweak-able. This will also solve the next issue.

    Lower contrast levels combined with setting the plethora of occlusion options cause the path tracer to not resolve the image. This results in breakdown of GI.

    Performance... It's nowhere near as great as it could be. Got a fair idea of how to improve that and have an experimental branch running here where it's almost twice as fast as what this build achieves. So expect good things to come.
     
    elbows, Lex4art, ftejada and 4 others like this.
  47. Baldinoboy

    Baldinoboy

    Joined:
    Apr 14, 2012
    Posts:
    1,523
    Thank you so much for your work @Ninlilizi !

    Couple quick questions-

    Known working and not working Unity Versions + OS? Good in 2018.2?

    Still working in Deferred?

    Thanks!
     
  48. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    605
    Oh my goodness, SRP support and performance gains? Where have you been all our lives @Ninlilizi?!? :) Thanks so much for your hard work and sharing it with the community.
     
  49. Ninlilizi

    Ninlilizi

    Joined:
    Sep 19, 2016
    Posts:
    294
    Still works in Deferred. While I've massively refactored all the code over the last month... Most of that was to enable forward and sps.... Deferred rendering behaves mostly similar to before. Though there there have been some changes to the lighting attribution as I rolled part of the reflection pass into the diffuse path tracer as part of that process.

    2018.2 is known good... I'm running Windows 10 with nvidia hardware and a rift for reference... I can't comment on vive support as those things are priced way out of my reach.
     
    Baldinoboy likes this.
  50. dahuilang

    dahuilang

    Joined:
    Jun 5, 2014
    Posts:
    32
    an error occured when use 2018.2.6
    "
    Assets/SEGI/SEGICascaded.cs(5,29): error CS0234: The type or namespace name `PostProcessing' does not exist in the namespace `UnityEngine.Rendering'. Are you missing an assembly reference?

    "