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. Dismiss Notice

[WIP][Asset] Dynamic Light Probes for Unity Indie, Pro, Mobile

Discussion in 'Works In Progress - Archive' started by BelfegnarInc, Jun 29, 2014.

  1. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Hello everyone. I am a member of the team developing games for mobile platforms (or at least trying to do it..). While working on lighting, I invented next wheel and named it Dynamic Light Probes. It may be used for the lighting of movable objects. Works with all platforms and licenses, in all rendering paths. Does not break dynamic batching. Just leave all lights in the scene, the system will do the rest. You can change light's parameters (position, range, intensity and color) in runtime.
    Stress test on Nexus 5. 1156 animated lights (and dynamically batched barrels).

    This system allows you to do dynamic lighting without increasing the number of drawcalls. And without a big performance hit. It bakes all light's data into a sort of "light volume", which is available to any object in any time. It can be a static geometry with precalculated beast-lightmaps, which can be illuminated by dynamic light sources further , or it can be dynamic objects.

    Advantages:
    + Editable and movable "light sources". Theoretically unlimited amount
    + Dynamic objects, static objects.
    + Dynamic batching.
    + Different types of "light sources".
    + "Working Area" around the camera or other world point. You can control balance between quality and perfomance.
    + Should work with all versions of Unity (tested on PC and Android). In all modes of rendering.
    + No blending or alpha test (mobile friendly)

    Disadvantages:
    - Problems with the height difference (although changing lighting supported in some way). Requires sophisticated algorithm. Working on it.
    - Lights not respect obstacles. Requires sophisticated algorithm.
    - With a small number of light sources, the benefits are not obvious (special shaders for objects used, not "free" for GPU).
    - Large areas require big amounts of data (Can be adapted by changing light density / quality).

    I'm wondering what you think about this. Will it be useful for you and how much you think it's worth?
     
    Last edited: Dec 14, 2014
    AntonioModer, liverolA and Origxn like this.
  2. Origxn

    Origxn

    Joined:
    Jun 27, 2014
    Posts:
    42
    This is clever, (even though not many people can find a use for it)
    But it would be cool to use those lights on a ufo :p. Which I think I will use it for eventually. And I think 10$ seems like a fair price
     
  3. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Do you mean there are no people who want to use tons of lighting sources at one scene (lanterns, flashlights, fireplaces, alternating with the time of day, etc.)? I think its not true.:) But with "real" lighting you drown in the sea of drawcalls (actually you have to tell it "Goodbye" on mobile platforms, if you are targeting on the wide range of devices).
     
    Last edited: Aug 14, 2014
    calmcarrots likes this.
  4. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,625
    Maybe you can say more about what this does and how it can be used? And what its limitations are? I'm interested in dynamic lighting and solutions that will work for higher level mobile.
     
  5. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    dynlightprobeswithskin.jpg

    Here is another example. At that screenshot you can see the scene with free assets from Asset Store. It is illuminated by 17 light sources. As you can see, all barrels batched in 1 drawcall, as they have the same material (men does not batch because of skinmesh). You can move lights and change their parameters, the number of dc and performance is not affected.
    p.s. #1 message updated.
     
    Last edited: Dec 14, 2014
  6. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    This could be really useful, anything that saves drawcalls but still have dynamic light is important to me.
     
  7. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Working on optimization. Stress test video added (check #1). 1156 animated point lights (and barrels).
    stressTest.jpg
     
  8. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Looking very impressive, any chance of a webplayer demo ?
     
  9. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    any updates on this ?
     
  10. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    - Spot light type added
    spotLight.jpg
    - Still working on correct height algorithm
    LightHeight.gif
    - Optimizations
     
    Last edited: Jul 26, 2014
  11. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Looking really good, the spot lights great. Will this support any form of bump mapping?
     
  12. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Well, as I wrote earlier, I'm interested in mobile gamedev and complex per-pixel lighting is not very good choise for it. Especially considering that in DLP getting a light direction is not so easy. Nevertheless, it is possible, by use of a few tricks. Although for the tangent-space normalmaps, you'll need gles3 support, but for world-space it's much easier, and gles2 is enough. As you can see, this trick also allows to light objects almost correctly, based on vertex normals.
    bumpmap_and_normals.jpeg
     
  13. Deleted User

    Deleted User

    Guest

    Can lights be created at runtime? What are you actually doing on the assets, vertex color?
     
  14. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Any time scale for a release ?
     
  15. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    No, you can't do it for now, for the performance reasons. But you can turn it on / off (and use something like ObjectPool).
    Actually, I do not touch it. Perhaps in time, i'll try to keep some information in the attributes of vertices for optimization.
    I work on demo scenes that will help to represent system abilities in details.
    dlpScene.jpg
     
  16. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    How are you doing this? IT LOOKS AWESOME!!! :)

    Also, a free version would be great. Means I could spruce up one of my mobile projects for free. all I really need though is a good (and Unity-free compatible for $0) light probe system.
     
  17. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    This cant come soon enough.
     
  18. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @dirtybassett: please state what you mean! I have no idea what you're talking about! :)
     
  19. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    I ment that a system like this will greatly improve the look of my environments. Can only get so far with static lighting.
     
  20. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
  21. Tristan-Moore

    Tristan-Moore

    Joined:
    Aug 22, 2014
    Posts:
    18
    Outside of mobile I would be interested in seeing what this could do to allow for a pseudo global illumination effect when combined with directional light, much like CryEngine. That could be extremely effective if you took it in that direction or if that's already viable. So from what you have said this will require custom shaders? Any chance it can work with existing shaders or shader packs?
     
  22. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @Tristan Moore: From seeing how this is done, what you might do with such a system would be to add one more layer of functionality, and perhaps do some sort of final gather calcuation that generates a set of 3D points with lighting information. This way, that info can be used to generate a set of indirect lighting probes.

    @BelfegnarInc: Would such a baked GI method like the above ^^ be possible with this system?
     
    Last edited: Sep 6, 2014
  23. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Guys, I apologize for delay. Some problems with AssetStore publisher registration (on my side, if you know what I mean ;)). At the same time, I continue my work on the system. Making it more user friendly (closer to designers than programmers).

    By "custom shaders" I mean that we need to provide information about light to the shader, as it is done in vertex lighting, pixel lighting or lighting from native lightprobe.
    Out of the box DLP will include multiple shaders with different lighting quality / performance. Basically it is simple diffuse, but there are a few special shaders such as this, which allows you to fake some interesting lighting:
    hemisphere_lighting.jpg
    It's "hemisphere lighting": DLP + sky light + ground light and / or directional sun light.
    If you need an existing shader to support DLP lighting, it is no more difficult than adding native lightprobe lighting to your (custom) shader. Is it a problem? I think this point needs to be discussed, I want to know how close designers are to shader code.

    In fact, I really have been working on a kind of extension (and you guys read my thoughts). It looks like something between FarCry 3 and Assasins Creed 4 GI. You bake indirect lighting information offline for every time of day (however I use native lightprobes for baking it to my probes, so it may be a problem for indie users and I need to rethink it). Then at runtime, you can dynamically blend that info based on sun direction. I would also like to add a dynamic gi relighting from dynamic sources, but do not know what platform will handle it.

    I do not want to make loud statements (GI is a sore subject on this forum, and many people have been disappointed more than once already :)). I think, I'll write some post on my strange blog, if I get some serious results, and give here a link.
    indRight.png
    indLeft.png indv33.jpg
     
    Last edited: Sep 8, 2014
  24. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Hmm... looks like GI's coming along nicely! :)
    All you really need to do is fix the weird green reflection coming off the blue cube. (Technically, the light should be blue, but being WIP, I won't push it! :D)

    And, unless one has asked already, and in that case, just quote the post for me, will this be free? or will it be a nice low price? ;)
     
  25. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    In fact, it's a blue reflection, but floor's shader used it incorrectly:)
    The sad part: all visual issues depend on lightprobe's positions (this is typical for gi in above mentioned games and for any lightprobe system, I think).
    What do you mean by "nice low price"? I planned to talk about it in this thread actually
     
  26. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @BelfegnarInc: By "nice low price," i mean't not ridiculously expensive. I would prefer something like $2, but $10 is okay as well. And of course, having it free would be asking for too much! :p

    And your GI system... how come it's doing it incorrectly? Isn't there some sort of way to grab the colour form the nearest probe, and use it to colour the GI?
     
  27. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Release date? o_O :D
     
  28. EtherGames

    EtherGames

    Joined:
    Jan 10, 2013
    Posts:
    12
    Is there any updates on the asset. I am actually eager to test this out as we have many overheads in the light issue. I am sure this would be very helpful.

    Please let me know when are you planing to release it and what would it cost.
     
  29. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    :D :) ;) :p
     
  30. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Any news ?;)
     
  31. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Maybe I should PM the guy... :p

    But didn't he say this light system was going to be featured in a game too? if so, maybe his absence means awesomeness may erupt soon... :D :) ;)
     
  32. blackbird

    blackbird

    Joined:
    Aug 9, 2011
    Posts:
    588
    i will buy it !! if you released about the price i can t tell ...but i will buy it
     
  33. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    As far as I know, this system was either going to be a free asset, or even just a couple of dollars: From what I remember either way, it wasn't much at all.
     
  34. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Are you still working on this or is it dead? :(
     
  35. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Mind if I PM this guy? :p
     
  36. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    It's definitely not dead and i am still working on it:).
    Here is an example of full 3d light volume (only light color info, without direction and textures).
    dlp3d.jpg

    Specifically what I do now:
    1) Optimization
    2) Сorrect light direction recovery in object shaders for proper illumination of faces and all bump stuff.
    4) Geometry occlusion for light propagation. So the light won't pass through walls, and generally more correctly distributed.
    3) Shaders combinations. I think to enable lighting as per object, and as an post-effects/lightpass (in some way it will give a constant predictable performance but will reduce the possibility of combining shaders with different performance). Also I think about the ability of switching some computations between CPU and GPU, depending on what is most loaded. Simply put, the system will look like this: the more opportunities you have (hardware, platform and Unity license), the more choices of algorithms and methods for calculations it will be, i.e. the higher performance and quality. So it's not a one universal algorithm with permanent quality and performance. This is the most slow-developing part:).
    4) Something like a cascade approach to the volume of light. It helps to distribute the load of calculations depending on distance and improve light quality near the camera. In short, it is LOD. At the moment, I am not satisfied with light quality in FPS view.

    Now, about GI.
    1.png 2.png 3.png green.png
    It has some limitations. Firstly, the light passes through the object with thickness less than distance between two probes. Second, it's 2.5d-kind, there is only one layer of probes along the Y axis and indirect light just goes into a neutral color with height (but every probe got info about light from 4 directions). This is closer to Assassin's Creed 4, so think of it as the outdoor ambient light for such geometry as city with closed houses or other open world. For indoor you will need to use something else, or greatly increase the density of probes, although the problem with Y axis remain. Maybe someday I will expand it to PRTV (Farcry 3) doped with LPV, but I don't have enough free time for now.
     
    Last edited: Dec 4, 2014
  37. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Here is a screenshot of a paper about AC4 for you to understand what I mean by saying "closer to Assassin's Creed"
    ac4.png
     
  38. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    So any release date on this? o_O

    Looking good, BTW! :)
     
  39. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Could you not release the light probes as in your first video's, then add GI later?
     
  40. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
    any news on this?
     
  41. liverolA

    liverolA

    Joined:
    Feb 10, 2009
    Posts:
    347
    any news on this?
     
  42. MrJohny

    MrJohny

    Joined:
    Feb 19, 2015
    Posts:
    73
    is this release? Or something news?
     
  43. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Quite frankly, this guy seems to have either vanished, or discontinued this asset, sadly... :( I can sort of see why though, judging by the impact unity 5 made on one of my free assets... :D

    If he's just AWOL at the moment though... give him time, it's probably for a good reason. He might even come back with mindblowing changes, who knows? :)
     
  44. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,625
    A lot of guys / projects disappear, usually because the dev takes on work with a company. I suspect that's what happened here.
     
  45. BelfegnarInc

    BelfegnarInc

    Joined:
    Jun 29, 2014
    Posts:
    32
    Hi guys. I want to tell you that I'm still alive and continue to work on this asset in my spare time. I spent last n-months on optimizations, GPU-version of the system, tests on different platforms such as web and webgl (quite good results, I must say =)), experimenting with the propagation of light with respect to obstacles (low-res). Almost stoped all works on indirect part (so that, most likely, it won't be included in the first asset release version, or it will be released separately). I want to note that Unity 5 update brought me more optimizations than problems for the system. Nevertheless, there is some unresolved points. For example, do I need to add support for PBR gles2 Standart shader (or leave it only with Legacy shaders support). The fact, PBR gles2 shader have almost no free attributes, interpolators and instructions. Thus, to add new features, one will probably have to remove the old part of the shader. Any thoughts on this?))
    Furthermore, since this system is a lighting approximation, benefits for pbr from it, is not obvious, I think. Although.. Optimizations, right?)
    Summing up, I want to inform you that in a month or two it will become clear what is it: a ready-to-use solution in Assetstore (I'm not sure that it will be approved, given the recent sad forum topics by noname-guys =)) or just my next closed experiment:)).
    Lastly, a few screenshots from my latest experiments (protect your eyes):
    3.jpg 2.jpg spot_lights.png interior2.png Screenshot_2015-07-24-00-35-34.png
     
    Last edited: Oct 12, 2015
    FuzzyQuills likes this.
  46. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Approved! :) I simply like how you've got normal maps working well together. :)
     
  47. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    232
    I would buy this in a heartbeat. Looks amazing!
     
  48. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    I agree here sir. :)
     
  49. javier11om

    javier11om

    Joined:
    Apr 27, 2014
    Posts:
    28
    Is this still being worked on? I would buy this without hesitation, I need lighting for my mobile gaming and regular lighting causes way too many drawcalls.
     
  50. lhy_ps2

    lhy_ps2

    Joined:
    Feb 6, 2014
    Posts:
    5
    will the author come out to say the progress of the plugin? it's useful on mobile