Search Unity

Dynamic Volumetric Lighting replacement

Discussion in 'Works In Progress' started by Lexie, Jan 11, 2016.

  1. Kevin-VFX

    Kevin-VFX

    Joined:
    Apr 17, 2016
    Posts:
    13
  2. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    William Chyr working on Manifold garden tested out my beta today in his stream. His game is a little abstract so he blew out the effect a lot. But it was really cool to see other people using it.

    Some tiny bugs popped up in the beta, I'm working on 5.1.2 support at the moment. I can't go any lower then that.

    Here is an image from his game with more stylized volumetric lighting. I think this is rendered at quarter resolution.
     
    Last edited: Apr 29, 2016
  3. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    So the implementation of those lights in that demo scene are really unfinished, those lights should be stored in an octree and culled. I wouldn't recommend anyone use that in their game unless the light will always be in the camera view, or you don't care about performance.

    It wouldn't support it out of the box, but could be extended very easily. I actually store all the lights in an octree anyway so it wouldn't be too hard to expand on that and make it a proper lighting system.
     
    Last edited: Apr 29, 2016
  4. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    Yeah that area light stuff is just an example of how to use command buffers. Unity appear to have a different area lights solution that integrates with their own volumetric lights solution as seen in the Adam demo and available later this year. How flexible and useable that system is, as opposed to being a starting point for more comprehensive solutions, remains to be seen.

    I'm glad you haven't given up Lexie. I like some of the other systems that are popping up but I will still buy yours.
     
  5. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Looks great, can't wait to see how it looks on my game
     
  6. Kenaz

    Kenaz

    Joined:
    Mar 4, 2015
    Posts:
    8
    @Lexie so... we don't have any chance to get your custom shadow solution? so sad :(
     
    Last edited: May 5, 2016
  7. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    What happened to this? I really need a good volumetric lighting solution
     
  8. camirving

    camirving

    Joined:
    Jan 20, 2014
    Posts:
    34
    I'm suffering due to Unity's builtin lighting system. Your system would be a great help.
     
  9. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    It has a lot of downside so its hard to release it. For the time being I've gotten volumetric lighting working with unity's inbuilt lighting. Should be releasing that part of it shortly, Just waiting for the next version of 5.4 as there is a bug in the current unity beta that stops my volumetric lighting from working.

    Sometime in the future ill release my custom lighting as a beta branch of this asset. but no time line on that yet
     
    ksam2 likes this.
  10. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,339
    How about the shadows?
     
  11. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Hey? can you elaborate a bit.
     
  12. Beinscheibe

    Beinscheibe

    Joined:
    Sep 24, 2013
    Posts:
    78
    I think he is refering to your custom lighting solution (like many others before).
    I feel a lot of the people here are "ready" to use it, even with the said downsides ;D
     
  13. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,339
    Personally I am only interested in directional light shadows. Do you have any plans to release a shadow asset?
     
  14. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I was only able to match unity's performance on a directional light. So I fell back to using unity's directional and added volumetric support to it. So even if i do release my custom lighting, it's going to use unity's directional with volumetric support.
     
  15. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    While I wait for the next beta of 5.4 to come out. I added support for density particles to the system.

    Rather then having to have random noise or some form of height density. I added the ability to flag particle systems so they can be used while calculating the density of the air at a point in the world.

    This means you can easily designate an area to be more foggy then others simply by having a particle emitter there.



    The reason I used unity's particle system is so you can leverage everything the particle system has.
    You could easily add wind to this effect or rotating particles, animated particles etc. This effect supports any number of particle emitters, although there is a small overhead for each one that needs to be rendered.

    I noticed the new doom has this effect so i thought it would be a good edition.

    Waiting for the next version of unity 5.4 to come out before I release. There is a bug with command buffers that should be fixed in the next beta. I don't want to release an asset that doesn't work for everyone using 5.4

    I'm looking into adding transparency support now. It will require people to edit their transparent shaders though. Ill include all the default ones with the changes applied.

    Edit: Switch out the image for a video example
    Edit2: switch out for a better video
     
    Last edited: May 25, 2016
    wetcircuit, ksam2, elias_t and 9 others like this.
  16. adventurefan

    adventurefan

    Joined:
    Jan 17, 2014
    Posts:
    199
    Looks fantastic.

    Will it have the point lights and shadow system from your old work too? I really liked those as well, even if directional lighting will be standard.
     
  17. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    The first release will be volumetric lighting that uses unity's inbuilt lighting. It will work on point/spot/directional and work with shadows.

    Later down the road ill release my complete custom lighting engine that give huge speed increases as a beta branch. but no eta on that.
     
    ksam2 likes this.
  18. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    I added foward transparency support, I think the system is complete now, no more major downside to my volumetric lighting for unity. Ill post a video sometime soon, its pretty late.

    I also optimized the density particles to render a lot faster. Really happy with everything now. I was pretty hesitant to release at first but now everything works really well.
     
  19. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    You are cool Lexie. Thanks for efforts
     
    Last edited: Aug 12, 2016
  20. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Here Is a video of forward transparency support. We have three test cubes at 99% 50% 10% transparency.



    The artifacts are most noticable when you have really bright lights and high density (like this scene). Overall it works pretty well.

    It has some downside though, but its better then having zero transparency support.
    It costs about 0.1-0.5ms (depending on settings) to render out the data needed for transparency support. So if you don't need it, its best to have this functionality turned off in the settings.

    Directx 9 can supports this but the quality for transparency gets capped at medium (this is automatic).

    I couldn't find a way to override unity's GCinclude files so I've made replacement shaders for all the transparency shaders unity offers.

    If you you have custom transparency shaders they will need to be edited to support volumetric lighting. Its pretty easy, only a few lines of code.
     
    Last edited: May 29, 2016
  21. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Any update on this cool project? Can I have a demo version?
     
  22. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Need to fix a bug with transparency support and then its ready to go. Although i need to do up documentation still.
     
    ksam2 likes this.
  23. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,219
    How much it's gonna cost.
     
  24. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    250
    wow - if it is as good as it seems it is on my wishlist. do you think its days or weeks or month to fix the transparecy issue and do the documentation?
     
  25. nbac

    nbac

    Joined:
    Jul 7, 2015
    Posts:
    250
    how is it with compatibility to custom shader solutions / enlighten etc. ... !?
     
  26. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    20$ USD? I haven't put a lot of thought into pricing yet.

    I just sent out my last closed beta that has Transparency and density particle support. Website/Documentation should be finished tomorrow. If everything goes well ill be submitting to the asset store midweek.

    My first release will add volumetric lighting to unity's inbuilt lighting. It works out of the box with opaque shaders.
    It does support transparency but it will require some shader work to get custom shaders working, Its only a couple of lines of code.
    It will come with alternatives to all of unity's built in transparent shaders.

    It doesn't conflict with enlighten, you can have it turned on at the same time, but only the direct lighting is ray marched.
     
    remption, John-G, punk and 1 other person like this.
  27. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    As you going to sell this asset can we test a beta version first for free? I doubt If I'm going to use it or not, so a demo version can help.
     
  28. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Documentation is nearly finished. PS4 support has been added for transparency and particle density support. xbox one should work but I haven't tested yet.

    Everything is looking good and on track to submit to the asset store.


    Ah I'm not sure about a evaluation version. the plan was to sell it cheap enough that people wont mind spending money on it if they want to use/play with volumetric lighting. It's also the fastest/best implementation of Volumetric lighting for unity I've tested so it has that going for it. I'll look into an evaluation version but no promises.
     
  29. jdraper3

    jdraper3

    Joined:
    May 28, 2015
    Posts:
    117
    Absolutely can't wait! Volumetric lighting makes an amazing difference and this is such a great implementation.
     
  30. Beinscheibe

    Beinscheibe

    Joined:
    Sep 24, 2013
    Posts:
    78
    A price ~20$ sounds great, even to test it out. And the people who don't like it afterwards can still ask for a refund, so from my side there is no need for an eval version.
    Just bring it to the store. I spend more money on assets that never got used, then 20$ on this (which will get used, I know that) :-D
     
    punk and Lexie like this.
  31. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    The main documention is so close to being done. Just have to make some more images and add a section on getting custom transparent shaders working with the system.

    I finished up the release build, I'll submit to the asset store tomorrow. Not sure how long this process takes. my guess is a few days. Should hopefully be live this weekend/first thing next week.

    Edit: According to Elbows it might take up to 10 days.

    Some feed back on documentation would be appreciated but i understand that will be hard with out actually using the tool yet.
     
    Last edited: Jul 21, 2016
    Bending-Unit-22, Kenaz and elbows like this.
  32. moure

    moure

    Joined:
    Aug 18, 2013
    Posts:
    184
    Good job on the documentation :) The only thing i would add is a performance section at the end with some general guidelines on which settings are the most performance hungry - which features cost nothing etc. A small tutorial - feature video (with captions or preferably audio commentary) on the set up and basic features is also usually great for the asset store and people that haven't been following your thread, cheers!
     
  33. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    Just to warn you that although things sometimes happen quickly, its likely to be much longer than a few days, especially for initial version.

    So whilst I hope it arrive sooner, I wouldnt bank on it being available in the asset store before a week-10 days.
     
  34. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,420
    A version that is the actual code that they can run inside their own Unity projects?

    If so then no, that idea probably isnt going anywhere and hardly any assets offer this. Dont get me wrong, I personally like projects that are, for example, available on github and then you pay if you want to license it. But I dont expect most asset authors to go down that route and I really dont blame them.

    If you mean a test executable project just to see what the end results are like then yes, a lot more assets do that.
     
    chiapet1021 likes this.
  35. chiapet1021

    chiapet1021

    Joined:
    Jun 5, 2013
    Posts:
    604
    One thing I will say about the documentation: those screenshots are gorgeous. :)
     
  36. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    387
    @Lexie Will definitely pick this up, looks great
     
  37. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    276
    Just wait for people to use it, post and show off what they do with it then. It's not really fair to developers to put a bunch of their time(which is time they could spend making money some other way), just for people to ask for them to give it away. Free stuff has their own costs, including support and maintaining separate paid and free versions
     
    Beinscheibe, moure, punk and 2 others like this.
  38. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    280
    if this works together with SEGI i would get it immediatly
     
    ksam2 likes this.
  39. Beinscheibe

    Beinscheibe

    Joined:
    Sep 24, 2013
    Posts:
    78
    Welcome to the world. Everything needs to be paid before you can really use it.
    And still you have the possibility to ask for a refund, so what's your problem with this?

    I can't think about any real way to provide a "test asset version" which might not get abused by people. Getting something for free, which is pretty much usable, people will more often just continue using it, abandoning the paid version, even if it has new features. So I think it's better the way it is.

    If you are really loose money on assets, you should consider asking the developers for a refund (like I said). Most of the times, they are happy to do this and you get your money back.

    But now back to the asset:
    Will get it if it's available on the store, to check out how it behaves compared to the Open Source version of Michael. Just have to wait now ^^
     
  40. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    So it wouldn't be too hard to add support for this, The way SEGI stores its data makes it very friendly to the method I'm using. It's definitely something I want to tinker with. I'll wait for SEGI to get more updates before I add that feature as I'm sure it will go through a lot of restructuring to add cascade volumes (biggest thing holding it back other then performance).

    Completely understand what your saying, I've also spent a lot of money on assets that I don't use because they didn't perform like they advertised (current every asset I've bought except 2). My goal is to make enough demos in different conditions to show the strengths and weaknesses. Hopefully that will be enough for people to make an informed decision.
    Also the cast of games using this asset will hopefully speak to its usefulness.

    I know other assets have an evaluation version you can use with a watermark. once I release I'll look into what that entails.
     
    punk, IronDuke, ksam2 and 1 other person like this.
  41. IronDuke

    IronDuke

    Joined:
    May 13, 2014
    Posts:
    132
    You have made this little duck very happy.:D Quack!

    --IronDuke
     
    punk likes this.
  42. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hi there, this looks very nice, did you manage to look at VR support in the end?
     
  43. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Havent tested with a real Kit yet, I've only tried it with trinus and it works. (because it supports multi cameras).
    I'll try and get my hands on a headset soon.
     
    punk likes this.
  44. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    While I wait for unity to approve my asset I've added some new feature.

    It supports 5.1.4 and above. I don't think i can go any lower with unity's inbuilt lighting.

    I've also added ambient lighting to the volumetric calculations. Its makes the results a lot more grounded in the world.
    It uses the ambient settings in unity lighting window. Meaning you can use the skybox / gradient / color for your ambient lighting and the volumetric lighting will use those settings. Making the volumetric effect a lot more grounded in your world.

    I've also added a sun value so you can add a sun to the volumetric pass.


    Album if you want to see what it looks like with out it

    Album for Sun On/Off

    Still no word from unity, i suspect this will take 1-2 weeks. But at least it gives me time to make some marketing material.
     
    Last edited: Jul 26, 2016
    elbows, punk, Kenaz and 4 others like this.
  45. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    276
    What's your publisher name so I can mash F5 on the Asset Store?
     
    chiapet1021 likes this.
  46. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Hitbox Team.
     
  47. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    522
    Nice! Quick question about the "sun" functionality in that album - I mostly notice the sun "burning through" the house geometry. Am I seeing this wrong?
     
  48. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    Yes, That is intended, When you take a photo of the sun you get bleeding over nearby objects. See how the tree seems to disappear.


    This effect simulates that. If the sun is completely blocked then of course you wouldn't see this effect coming through.
    most people simulate this using a flair in unity, but that tends to either be on or off. Doing it the volumetric pass makes it look a lot more natural. It makes a lot more sense in motion, Ill have a video soon.
     
  49. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    522
    Okay, great! Is the intensity of that effect hard-coded or can it be controlled through a slider?
     
  50. Lexie

    Lexie

    Joined:
    Dec 7, 2012
    Posts:
    646
    There is a slider, 0 = off.
     
    one_one likes this.
unityunity