Search Unity

SEGI (Fully Dynamic Global Illumination)

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

  1. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    151
    Just to be completely sure.. this gets picked up by someone else and that will be paid for again?
    If so It's pretty unfair towards the customer. I bought this hoping it'd be improved upon. I won't be buying assets like these if I have even 1% doubt about the creator, no matter what personal issues that person may be having.
     
    Crossway, arnoob and RB_lashman like this.
  2. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    How's progress on the GitHub build?
     
  3. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Given that the only factor sponsoring my complaints on this thread was an apparent allergy to actually releasing versions, I wait very nervously to see if the github version ever appears.
     
    arnoob and RB_lashman like this.
  4. Simon-O

    Simon-O

    Joined:
    Jan 22, 2014
    Posts:
    51
    I just went to grab the latest version and spotted the deprecation.

    First up... Bravo. SEGI is really impresive as-is, and no doubt it will go on to be a staple of many projects when it's finished. I also respect the way you've tried to meet your obligations and extricate yourself gracefully.

    That said, please do NOT use GPL, it's a poison-pill for anyone who doesn't want to give away their entire project for free. Businesses avoid it like the plague. L[esser]GPL is better in some scenarios, but they're unlikely to apply here.

    I have to admit that if you go down that route, I'd object rather strongly as you'd be forcing me to choose between abandoning my purchase to start from scratch -or- being stuck on a dead-end branch that's never updated.

    I'd personally prefer this open-sourced under MIT or Apache, but anything easily used in commercial products would be fine.

    In any case, thanks for you efforts. I don't regret the purchase.
     
    Martin_H, RB_lashman and Abuthar like this.
  5. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    It's going quite well now. I did experience some weird stability issues with the latest cascades version which slowed progress a bit, but I think I've solved the issue. Whether it's solved or not, I'm pretty sure it was a Unity stability issue that may have been specific to my hardware (the issue was experienced in Unity 2017.1.0f3). I haven't experienced any issues lately, however.

    I'll double check that I didn't mess anything up with the GitHub page itself and probably make it public today.

    Now I'm just finishing up cleaning and commenting the code to maximize the chance of others understanding the code and being able to contribute to the project. I'm a self-taught programmer and have never collaborated with other programmers on a project, so I'm sure I have some unconventional habits with my code, and I'm not terribly adept with git, but I'm trying to make it as "collaboration-friendly" as I can.

    The great thing is that I don't have to be so weary to make a release on GitHub, because if it's broken or I missed something, I can fix it right away. I had to be very cautious on the Asset Store because I knew that it could take up to a week for an update with a fix to be approved, which would mean that a broken/problematic version would be on the store for however long it took to approve the new version. Now it'll be pretty much instant.

    The new release will now have two main scripts, "SEGI.cs" and "SEGICascaded.cs". The former being mostly the same SEGI you guys are familiar with (besides a few optimizations and blue noise), and the latter being SEGI with cascades functionality. Both the standard and cascaded versions are inside the Assets/SEGI folder (to avoid cluttering your base Assets directory and potential issues when updating). Since they're both sharing the same directory, all shader files/resources for the cascaded version have the suffix "_C".

    Also, be prepared to use slightly different values for various parameters for the cascades version than you may be accustomed to.

    And of course, if you ever need to roll back to v0.83, there's a release on the GitHub page for that.

    Thanks, Simon! I've decided to go with the MIT License.
     
    Last edited: Sep 19, 2017
    DragonmoN, punk, arnoob and 13 others like this.
  6. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Hey everyone, I've just published the GitHub page for SEGI, check it out here: https://github.com/sonicether/SEGI

    There you can download both v0.83 and the new v0.9.0 with cascades support. Please let me know if I flubbed anything and I can try to fix it as soon as possible!

    Thank you all for your understanding and patience!
     
    DragonmoN, FPires, punk and 18 others like this.
  7. IronDuke

    IronDuke

    Joined:
    May 13, 2014
    Posts:
    132
    Howdy @sonicether ! I have a quick question. I looked at the license file and it seems to indicate that one could actually sell SEGI to other people. While I don't plan on doing that with anything I get for free, my question is whether this Github version of SEGI may be used in commercial games made with Unity?

    Thank you and I'm sorry if that's a bit presumptuous; I really am wondering. Even if I can't use it in commercial projects I'll likely download it anyway at some point to play around with since it's so pretty. :)

    --IronDuke
     
    RB_lashman likes this.
  8. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Yep, you can still use SEGI in commercial projects/games made with Unity!
     
  9. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    Hm, the cascaded version crashes my NVIDIA driver and then Unity (Unity 2017.1.0f3) itself. Odd, since the normal SEGI works just fine.
     
    Crossway likes this.
  10. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Okay, that was the issue I was speaking of earlier. I suppose it must be a Unity related issue. Try updating unity and see if the issue persists (it hasn't happened to me since I updated).
     
    RB_lashman likes this.
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Just tried cascaded version. It works for me on GTX 750 Ti using v2017.1.p2 ( just the latest patch)... However the UnityEditor name space is included in the SEGI.cs script which prevents a project from getting built... Comment the line fixes it. May be was included by mistake... !
     
    RB_lashman likes this.
  12. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    Could also be my graphic chip (Nvidia GT 555M). On the other hand, the version without cascade works fine, so... looks like it might indeed be the problem that you had before, too. I'll update Unity and let you know, if the issue vanished.
     
  13. IronDuke

    IronDuke

    Joined:
    May 13, 2014
    Posts:
    132
    *squeals in unmanly fashion*
     
    Kolyasisan, RB_lashman and neoshaman like this.
  14. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    Still crashing for me, unfortunately...

    EDIT: Wait a minute... It's just the "Update GI" that's doing the crashing. As soon as I turn it on, it crashes my graphic driver. Hm... bummer.
     
    Last edited: Sep 20, 2017
  15. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    RB_lashman likes this.
  16. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    Same for me. Tried with 2017.0.3f and 2017.1.1f. Intel HD5500.

    The performance is noticeably improved in non-cascades version. On low resolution the performance impact is pretty small now even on such a low end GPU.
     
    Last edited: Sep 20, 2017
    RB_lashman likes this.
  17. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Thank you!
     
    RB_lashman likes this.
  18. tweedie

    tweedie

    Joined:
    Apr 24, 2013
    Posts:
    311
    Just terrific, thanks so much for all the hard work SE, can't wait to see how the community takes SEGI forward.
     
    RB_lashman and BruceBarratt like this.
  19. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Thanks so much for proving my doubts wrong!
     
    RB_lashman likes this.
  20. andrej-szontagh

    andrej-szontagh

    Joined:
    May 18, 2017
    Posts:
    20
    Hi Sonic Ether,

    How important are the compute shaders ? You cannot accomplish that using standard shaders ?

    I took a fast look into the code and it looks like nothing very special there.
    I have never used compute shaders before to be honest. But I did write OpenCL kernels in the past.

    Andrej
     
    RB_lashman likes this.
  21. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I cant speak for how they are used by SEGI but its now becoming very normal to use compute shaders for a range of tasks in game engines - eg post-processing.

    The main thing that has impressed me about Unity in recent years has been the efforts to get the same compute shaders running on an array of platforms/graphics API's. This is part of the reason why their use can now become more mainstream in Unity.
     
    RB_lashman and Martin_H like this.
  22. andrej-szontagh

    andrej-szontagh

    Joined:
    May 18, 2017
    Posts:
    20
    I need this running on WebGL 2.0 .. so no compute shaders. However they don't seem necessary. So compatibility wise not a good idea.
     
    RB_lashman likes this.
  23. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    The whole plugin is DX11/DX12 based as it uses geometry shader for voxelization (if i am not mistaken)... so there is no way to run such system on any platform which does not support Compute Shaders (i think SM5.0) !
     
    RB_lashman likes this.
  24. andrej-szontagh

    andrej-szontagh

    Joined:
    May 18, 2017
    Posts:
    20
    That's a problem .. Maybe there is some other method for voxelization .. I wasn't thinking the voxelization is based on geometry shaders .. why not use rasterization ?
     
    RB_lashman likes this.
  25. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Please someone post his Project with 0.9 and pre 0.9 to see the blue noise & cascades power up :D
     
    RB_lashman likes this.
  26. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Wow. Just downloaded it and expected to be disappointed, but now I'm absolutely stunned.
    I didn't think this would actually work SO well!

    When I add this to my game I'll definitely donate / buy / whatever to support this.
     
    RB_lashman likes this.
  27. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    432
    How does this compare to Enlighten for large scale outdoor environments?
     
    RB_lashman likes this.
  28. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Try it out, the download link is on github. The cascaded version works pretty well in some scenes I tested it in.
    Since it really seems to depend on the scene I think you best try it yourself.

    @sonicether I'm getting some huge spikes when using a terrain. I doubt there's any way to stagger the calculation over multiple frames since the unity terrain engine doesn't support it, right?
    Only happens in the cascaded version.

     
    RB_lashman likes this.
  29. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I know its not a positive development as far as WebGL 2.0 goes and I feel the pain of people targeting this platform that are well used to various limitations and will more than groan at another modern tendency that isnt available to them. But I cannot help but report that this stuff has been around for long enough on many other platforms that it is now becoming more normal and people writing modern effects etc have more reasons to start with compute shaders and associated data structures as a foundation of their systems.

    People associated with the WebGL standards know this trend is growing stronger and have a compute shader extension planned for WebGL 2 but who knows how long it will take, what limitations will exist or how broad a range of devices end up supporting it.
     
    RB_lashman likes this.
  30. redemprez

    redemprez

    Joined:
    Aug 14, 2017
    Posts:
    29
    SEGI is the most awesome thing I've seen in Unity. Please, keep developing it, It's jaw-dropping! :) Thank you for this!
     
    RB_lashman likes this.
  31. Afassolas

    Afassolas

    Joined:
    Apr 10, 2013
    Posts:
    78
    Just tried the latest version and it cannot produce an .exe it crashes just before building and it also creates something strange. It ruins several other scripts in the scene and you have to reimport them to work again. So for me if you cannot build an exe is useless. I am also having several lighting issues like lights are flashing in the scene for no reason but I haven't looked more into that.
     
    RB_lashman likes this.
  32. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Ah, that's unfortunate! I do wonder why I was getting the same crashes and then they just stopped happening. Well, thanks for narrowing it down to the Update GI function, that's definitely useful.

    It would also be useful if you could check the shaders in SEGI/Resources by selecting them in the Assets window (individually) and looking at the Inspector making sure that there aren't any compile errors that Unity didn't notify you of in the console (I've had that occur before). One of the crashes I had seemed to be related to that.

    This problem is going to be difficult to track down.

    SEGI requires a multitude of SM 5.0 features, not just compute shaders. Unordered Access Views for writing into volume textures atomically and arbitrarily, geometry shaders for voxelization, and so on. Unfortunately, it's just not practical otherwise.

    Whew, yeah, those are some big spikes. I have noticed in my testing that terrain in general is very expensive to voxelize, and that huge spike you see occurs when the largest cascade level is being updated, so a large area (if not the whole area) of the terrain's patch mesh needs to be built. A possible solution would be to bake the terrain itself into a static mesh and use that for voxelization (it doesn't need to be very detailed), but I realize that some projects can't really do this (if terrain is generated at run-time). I plan on offering individual culling/layer masks for each cascade level, and once this feature is implemented, you could just exclude the terrain from being voxelized in the largest cascades.

    EDIT: Come to think of it, does adjusting the terrain quality (I believe it's called "pixel error" in the terrain settings) affect the performance hit here?

    Perhaps someone with a little more knowledge of Unity's terrain system can offer some advice regarding this issue.
     
    Last edited: Sep 20, 2017
    RB_lashman likes this.
  33. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Thanks for catching that, Vagabond! I've updated the latest release with the fix. For everyone having build issues, please re-download the latest release!
     
  34. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    I did this and this is the result:


    (https://imgur.com/fM7bFIe)

    Having no knowledge of shaders really, I don't know if they're compile errors?!
     
    BruceBarratt and hopeful like this.
  35. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    I try to red the voxelization process, yup out of my league lol :D
    That's great we can poke and learn from it!
     
    RB_lashman likes this.
  36. sonicether

    sonicether

    Joined:
    Jan 12, 2013
    Posts:
    265
    Nope, those are just compiler warnings, not really a big deal. I'll have to see if I can figure out how to reliably reproduce the crashes, then move from there. Thanks for your help!
     
    RB_lashman likes this.
  37. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    On mine I just do:
    New Project
    Add Segi Cascaded to MainCamera
    Press Play (Works fine)
    Press Stop
    Add Cube to scene
    Press Play (Full system freeze, have to hold power button on laptop)

    Oh I have also tried making sure to set deferred shading and linear lighting.
     
    RB_lashman likes this.
  38. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    am i able to use with VR?
    PDF guide say i must switch to deferred lighting, VR must be on forward though
     
    RB_lashman likes this.
  39. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    Issues with the cascaded version may be caused by clipmaps and irradiance clipmaps memory leak. I just fixed it.
     
    Last edited: Sep 24, 2017
    arnoob, TooManySugar, hopeful and 2 others like this.
  40. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    I'll copy in the changes to my project and give it a try.
     
    RB_lashman likes this.
  41. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    You can use with VR in deferred, apply screen space antialiasing. VR does not have to be in forward, but forward benefits from x8 MSAA.
     
    RB_lashman likes this.
  42. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    Doesn't fix the crash unfortunately. So far we know it's on 2 low end gpus so perhaps the problem is in the SEGIVoxelizeScene_C shader file?
     
    RB_lashman likes this.
  43. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Its "crashing" for me as well. (Nvidia GTX 980)
    Everything turns white and then a popup at the bottom "kernel driver 376.33 didn't respond and was restored".
    Only happened in the cascaded version for me so far.
    I didn't apply @nxrighthere s change yet.

    Sounds like this is happening to many people (which is good news of course, if many people can reproduce it, we can figure it out together :D)
     
    RB_lashman likes this.
  44. BruceBarratt

    BruceBarratt

    Joined:
    Jun 20, 2015
    Posts:
    57
    That's true. I'm relieved it's not a problem with our cards. if a 980 has problems we definitely need to fix it.
     
    Mauri and RB_lashman like this.
  45. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    @sonicether I tried to figure out how to prevent the lag spikes as you suggested.
    Pixel Error has no effect whatsoever, neither does BaseMapDistance.

    What fixes it is either completely disabling "Draw" on "Tree & Detail Objects", or simply unchecking "Collect detail patches".
    Not a permanent solution, but maybe its a hint that will guide us into the right direction.
    Unchecking collect detail patches will fix it but consume a lot of memory. (1.5gb more in my little test).
    But tbh its a unity terrain issue, not something you can or should fix.
     
    RB_lashman likes this.
  46. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Exporting out an .obj of the terrain and decimating in a 3d modeling package is always a good option for terrain objects. You can use RTP or another advanced terrain shader to do tessellation on top of the decimated mesh, if you prefer. This solution is not good for runtime spawning of terrain objects, but otherwise it can reduce your drawcalls by several orders of magnitude.
     
    RB_lashman likes this.
  47. redemprez

    redemprez

    Joined:
    Aug 14, 2017
    Posts:
    29
    Two issues that I encountered (and one question):
    1. If I turn emmision on material it contributes to GI nicely, but if I turn it off, it still is in GI. Workaround: leave emission enabled but change the color to 0.
    2. If I enable FPS Character controller, SEGI in Game view (which is my Main Camera view) is instantly disabled.
    3. Is there a way to enable SEGI in scene window?
     
    Last edited: Sep 21, 2017
    RB_lashman likes this.
  48. andrej-szontagh

    andrej-szontagh

    Joined:
    May 18, 2017
    Posts:
    20
    Thanks for the reply. I didn't actually studied the code much yet. It looks like I cannot really use it in my project. However I am die hard coder who doesn't give up easily. Maybe I can make multiple versions like web version and standalone PC version .. or wait for WebGL 3.0 or something .. or consider different methods for building voxel data in real-time.
     
    RB_lashman likes this.
  49. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    @BruceJRBarratt @dadude123
    After Unity crash, press Win+R, paste %localappdata%\Unity\Editor and hit enter. Attach to the post Editor.log and Editor-prev.log please.
     
    RB_lashman likes this.
  50. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    I can test any build on gtx1080 here, so feel free to share compiled versions for testing and log sharing
     
    RB_lashman likes this.