Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

SEGI (Fully Dynamic Global Illumination)

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

  1. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,749
  2. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    SEGI 2 ? lol
     
    Aniow, Lex4art and RB_lashman like this.
  3. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    That's exclusively for Minecraft, I think?
     
    RB_lashman likes this.
  4. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,749
    Yeah, SEUS is a shader pack for Minecraft (see).
     
  5. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    484
    Can you tell us what company you sold it to? Are their plans to sell it as an asset or use exclusively in their product?
     
    RB_lashman likes this.
  6. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    564
    At the moment they plan to use it exclusively in several of their games. I can't give you more details, sorry.
     
    RB_lashman likes this.
  7. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Ok may not be totally realtime but looks brutally fast. I asume there is no precompute.
     
    Aniow, AntonioModer and RB_lashman like this.
  8. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    960
    There is precompute as in every standard lightmapper but is really fast. And note that here are only 4 lightmaps which means that not that much texels are calculated !

    But yeah i guess would be much nicer to use the GPU lightmapper if you have a good enough GPU of course !
     
    TooManySugar and RB_lashman like this.
  9. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Awesome tx for the info I was finding none. Sadly I dont see it in the 2018.2 features list so will have to wait. I've a 1080 waiting for some computing abuse. Cant wait.
     
    RB_lashman likes this.
  10. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    The new GPU lightmapper still can't be used at runtime though, right?
     
    RB_lashman likes this.
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    960
    No, its purpose if you allow you to faster bake your lightmaps !
     
    RB_lashman likes this.
  12. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    I get it. Just that this thread and others about realtime GI have been about procedural, runtime scene geometry (even scenes that are mostly static after initial generation as part of the scene load). So even if the new lightmapper is super fast, it doesn't address the need here.
     
    RB_lashman likes this.
  13. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    960
    Plus it is editor only feature - at least i haven't seen information about runtime support ( i guess it would not be possible )
     
    RB_lashman likes this.
  14. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Will this going to get implemented in Unity 2018 ?
     
    RB_lashman likes this.
  15. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,749
    Well, if you manage to get it working in 2018.X somehow, feel free to share (or be a d*ck like nxrighthere) :)

    I think it's safe to say that this is dead (for now). Sonic gave up on it completely and no one contributes to it. One of the drawbacks of going open source, but we all were aware of that potential risk.
     
    TerraUnity likes this.
  16. mykillk

    mykillk

    Joined:
    Feb 13, 2017
    Posts:
    59
    EvilFox and RB_lashman like this.
  17. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    I think Nasos did improve the performance a good amount. He provided some comparison screenshots in his asset's thread a few weeks ago.
     
    RB_lashman likes this.
  18. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    212
    How semi-realtime voxel-based GI was made in recent Unigine 2.7 update:

    This GI solution feels well balanced for practical use with millions polygons in the frame.
     
    Aniow, AntonioModer, GenaSG and 2 others like this.
  19. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,257
    it's basically baked SEGI (no recompute of the voxel lighting while moving) supported by cubemap and ssr to cover limitations
     
    Aniow, RB_lashman and chiapet1021 like this.
  20. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    212
    Yeah, but this is very smart implementation - voxel volumes can be placed inside each other, voxels that are not connected to any surface can be removed, etc, etc. Sum of those tricks makes it work in the end, at least at first glance.
     
    RB_lashman likes this.
  21. N00MKRAD

    N00MKRAD

    Joined:
    Dec 31, 2013
    Posts:
    210
    But it has the old problem: Not suitable for procedural levels.
     
    hopeful, chiapet1021 and RB_lashman like this.
  22. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,172
    I hate the whole baking stuff, because moving a camera through a

    - static model that has been
    - baked for hours

    is simply not "realtime" to me....

    Hopefully a true realtime-gi solution similar to segi will come one day.
     
    RB_lashman likes this.
  23. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,257
    Baked is the only way to have real time juice and the amazing visual.

    SEGI gave us near real time with some limitation, I don't understand anything in teh code, if only someone could do a walkthrough for baby and heavy commented the code, more people like me who don't have enough time would jump on it.
     
    RB_lashman likes this.
  24. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    Am I correct in understanding that SEGI doesn't have cascades and won't any time soon? Is there a workaround for hybrid indoor/outdoor scenes, for example use SEGI for indoor only? That should make the voxel size workable.
     
    RB_lashman likes this.
  25. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,257
    I think cascade were implemented just before abandonment.
     
    jefferytitan and RB_lashman like this.
  26. mykillk

    mykillk

    Joined:
    Feb 13, 2017
    Posts:
    59
    So I spoke to the Sky Master Ultimate developer on Reddit. This is what he had to say on his SEGI branch:

    "I have done some extra optimizations in the SEGI main script and will be working more on optimizing further the system and integration with the upcoming customized soft shadows system and other parts of the sky system. This will be ongoing WIP for some time, though the current optimization even though simple can increase the performance a lot."

    I also followed up and asked him if he was working on some of the weak points of SEGI like limited draw distance and light leakage. He said:

    "The SEGI will be an ongoing process of improving upon any point possible, so sure i will check all possibilities in future versions. Currently i have also done the optimization in the cascade version and seems to also work great, so this will be another option in the next update."
     
    Aniow, jefferytitan, N00MKRAD and 2 others like this.
  27. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    Does anyone know how SEGI works?
    1. I'm not clear on how it gets the voxels... does it take the meshes at render time and voxelize? Does that mean that it is only aware of geometry within the frustrum that isn't occluded? What if you have a bright blue wall behind you?
    2. I've seen samples with ground reflections. I gather this is based on the voxel data. Is there a way to turn this off if you want to use SSRR or some other reflection solution?
    3. If we can figure out how the reflections work (and depending on the answer to question 1) could it be combined with SSRR to fill in the gaps in SSRR with lower quality voxel reflections? Combining SEGI with kode80's SSRR might be fun.
     
    RB_lashman likes this.
  28. CGSpc

    CGSpc

    Joined:
    Feb 19, 2014
    Posts:
    8
    as I remember (according to my knowledge):
    1. SEGI voxelize entire scene that is inside specified region regardless of camera frustum
    2. " I gather this is based on the voxel data"
    yes,you are right.you can disable reflection at the lowest part of the SEGI Component parameters.

    3. Test it yourself and share the result with us here :D
     
    jefferytitan and RB_lashman like this.
  29. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    I've done some preliminary investigation. The trick will be getting the various phases in the right order. Currently the SSRR doesn't pick up the GI lighting. We also don't want SSRR affecting GI or GI reflections being reflected again by SSRR. As little as I want a deep integration I'm considering copying SEGI's reflection code into the SSRR, solving the chicken and egg problem.
     
  30. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    By the way I'm experiencing a weird effect with my SSRR test scene. SEGI seems to be failing to converge with Stochastic Sampling on. That shifting static look. I haven't experienced that with any other scene that I've put SEGI in. Any thoughts? Some wrong setting? Could another shader be flushing the buffer that SEGI uses? It happens even when I turn off "Update GI".
     
  31. OnlyVR

    OnlyVR

    Joined:
    Oct 5, 2015
    Posts:
    54
  32. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I've already asked this question before, but can SEGI run on Nintendo Switch ? SEGI is DirectX 11from what I understand and the Switch is compatible with Vulkan, Open GL 4.5 and ES.

    I'm still searching for the best lighting system for my game with some procedural levels and I have 3 options :
    - Basic out of the box components from Unity (Lights w/ cookies, Ambient Color, Intensity Multiplier) : Convenient but devoided of flexibility and realism.
    - Lightmapping : The most realistic option but exhausting considering the amount of assets I have to make (several thousands). Plus, dynamic objects are not affected by lightmaps, unless reflection Probes are used.
    - Realtime GI : Like SEGI which I don't really know about in terms of performances, but looks like a potential solution if it can work on average configurations + Lights if really needed.

    So I would like to know in depth how SEGI affects performance on the Lowest setting (I see no difference between Low and High settings). Is it really a performance killer ? Otherwise I think it would be a great option for a "background" lighting system in interior levels, or scenes that may not exceed 200.000k Tris for example.

    Here's an example of an interior scene with SEGI in Low and Cones + Cones lenght at 8. I also use a x2 Anti Aliasing (MadGoat SSAA) and some Screen Space Reflections. The scene is far to be optimised (200.000k Tris) because there is distant geometry beyond the room I show - also Unity seem to uselessly multiply the polycount for some reason, I have to figure out that issue later on (Unity Chan takes 100.000 Tris... what ???)

    Edit : Acccording to the Profiler, it looks like SEGI takes 4ms on this scene.

     
    Last edited: Jun 18, 2018
  33. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,257
    You can use proxy mesh to feed segi, which mean you can either procedurally generate them or if you use module assembly, have them ready when you spawn the module.

    Unity lighting use multipass, which mean the same triangle get rendered multiple time for each pass, which increase the counter. If you use a shader with no lighting pass and the triangle count decrease.

    However segi is expensive, I got 11fps on the procedural demo with a machine roughly equivalent of the wii U in early released.

    Just make a test scene and import it to switch, you have no choice
     
  34. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I think the demo level SEGI setting is set to High but with Half-resolution active. I use Low with a wide Voxel box (1000) and Cones set at 8. I want to use Realtime GI just for general illumination, so it's okay if the light is not so accurate.

    Do you have the 11 FPS in the Editor or in Standalone ? Editor takes half of your system ressources, if not much more. I just figured this out yesterday.

    I dont understand your first paragraph with Proxy meshes and module assembly. Is it different than putting SEGI on a camera ?

    About the Switch, i don't think it's comparable to the Wii U. I read here and there it's closer to a stock Xbox One. The problem is, I would have to get a Dev kit from Nintendo to test everything at some point, or a new PC with a similar configuration (Tegra X1, 8 cores at 1Ghz CPU, 4Go RAM).

    Here's a Split-screen test with 4 Players / Cameras. It takes about 25% of power in total (less than 10 with one Camera). By the way, you can see SEGI causes a weird reflection on meshes when the camera gets close to anything. Why is that ?

     
    Last edited: Jun 19, 2018
  35. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    528
    as developer for switch and wii u SEGI doesn't run with them , i can't even compile
     
  36. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    So, should it be because SEGI is DirectX 11 compatible only ?

    Mh... So I would have to take a look at Hxgi instead, unless there's another way around for SEGI in Vulkan or Open GL.

    I see some people already achieved Realtime GI on Open GL - this thread looks interesting :

    https://www.reddit.com/r/GraphicsProgramming/comments/5hdbg8/i_made_a_realtime_global_illumination/

    In Unity, I'll switch to Vulkan API so that I can see what can work on Switch.
     
    Last edited: Jun 19, 2018
  37. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    1,749
    This is neither realtime GI, nor an Enlighten alternative. And OctaneRenderer for Unity (2017) got released months ago - old news.

    Even if it compiles, I wouldn't expect a good performance.
     
  38. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Godot 3 runs very well with cone tracing on such scenes on global illumination low setting instead of max settings.
    Unfortunately it's baked voxels while it looks great, and Godot 3 is not an approved 3D engine for consoles.

    Your scene is mainly static lighting and some emissive materials , why not staying with Enlighten lightmaps when level lights are not dynamic?
     
  39. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I have to say I've never used Enligthen or tried anything with the Global Illumination techniques offered with Unity. I'm just concerned it would not work on procedural levels.

    I just attempted to make a Vulkan API Build, but it Crashes at launch and I get this error :

    amdvlk64.dll caused an Access Violation (0xc0000005)
    in module amdvlk64.dll at 0033:d4d6a1a1.

    Tested with DirectX 11 : It runs like butter on a frying pan (200 Mo of RAM used in my scene).
     
    zenGarden likes this.
  40. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,257
    proxy mesh are mesh that are rendered to segi instead of your game mesh, by being lower rez and low poly it can save a few cycle, they just have to match roughly the material environment for the light you want, which mean they don't have to match the actual environment and can be totally different if this what you wishes for effect.

    BTW global illumination is basically a occlusion/visibility problem, that is which pixel see which other, which is exactly what enlighten do, they create surfaces (which are basically big pixel collection with a min size of 4²) and store inside each surfaces what other surfaces it see, to what amount, then cull the list by order of contribution by a defined amount size (like the 10 most contributors). For rendering, it process the global average color of a surface, then compute direct light percent falling on all surfaces, then use the list of contributor to query that light and color information to add to its surface before rendering to actual mesh. Because the visibility occlusion is baked, it's rather fast, as it is a low resolution query of a few data.

    SEGI does the same at the voxel level instead of the surface and each frame instead of baking time, which is expensive.

    Depending on the structure of your pcg generation maybe you can take advantage that you control it to create visibility/occlusion to create your own solution?
     
    wetcircuit likes this.
  41. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    SEGI will never work well on switch, just forget that, even if it did work, there aren't any optimisations you can do to save it.
     
    Mauri likes this.
  42. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I have no idea what I am doing but I try to convert this code for Unity :

    https://github.com/Friduric/voxel-cone-tracing/tree/master/Shaders/Voxel Cone Tracing

    It's the first time I take a look at something related to rendering in Unity. At least it gets me interested to how things work a little by comparing to SEGI's code.

    Obviously this code doesn't have Unity's Directional Light and Emissive Materials, and shadows should not work in Unity.

    Anyway, I certainly can't achieve what other guys just try to achieve since many years, unless I become... intelligent.
     
    Last edited: Jun 20, 2018
  43. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    What is your real problem? achieving a GI look that's static? if so (while being procedural) then there are better ways to skin this cat!
     
  44. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I think what I like about Voxels Realtime GI is that all meshes are directly affected, the result is good enough in Low settings and it takes no memory space.

    Considering the amount of rooms I have to make, Lightmaps would take a lot of space I think, unless I make them very low-res just to achieve what I did with SEGI.

    I would consider using a Lightprobes generator it I happen to switch to Lightmaps. Does this look like a good solution ? https://assetstore.unity.com/packages/tools/level-design/lightprobe-generator-96395
     
  45. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,727
    It's a terrible "solution" that has nothing to do with your problem. That is just adding probes - something anyone can do with a couple of clicks. It also won't affect static geometry, and won't really work like you think it might.
    • Do you need to generate levels at runtime? If not then enlighten (with realtime gi, not baked) is likely all you'll ever need and has no baking time to speak of
    • Do you change lighting once the game is running?
    • How many dynamic objects are there and what are they?
     
  46. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    - I have an asset called Q Maze for generating levels. I just need to generate levels when a scene is loaded.
    - I don't need to change lighting.
    - Players + Any small / medium sized items.
     
  47. jefferytitan

    jefferytitan

    Joined:
    Jul 19, 2012
    Posts:
    88
    I think that many games could benefit from GI just a tiny bit more dynamic than Enlighten allows. Most people aren't making Minecraft, they just want to create/alter the level layout at level load time, or perhaps they have a handful of meshes that need to move (e.g. doors than open and close). I wonder whether one of these solutions could be modified to provide lazy runtime baking.
     
    chiapet1021 likes this.
  48. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    I might be wrong, but it looks like SEGI is less consuming than Post Processing Stack's SSR. I have MadGoat SSAA (x2 and x4 Anti-Aliasing), and it runs hardly with SSR On (+ SEGI). With SEGI alone, it runs very fluently. Unless it's a compatibility issue, how can SSR be more demanding than SEGI ?

    I figured out the issue with weird reflections : Temporal Blend Weight have to be set to 1.

    Also, can you explain me how SEGI can work with Cones set to only 1 ?
     
    Last edited: Jun 21, 2018
  49. Yuki-Taiyo

    Yuki-Taiyo

    Joined:
    Jun 7, 2016
    Posts:
    72
    What do you think about this little technique for filling rooms with light when your main material doesn't reach the whole scene ?

     
    arnoob and hopeful like this.
  50. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It looks strange, not as good as global illumination.
    But it's a good trick, does it run faster than global illumination ?
     
unityunity