Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. 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

[SHOCKING] Procedural Lightning - Fastest, AAA Quality, Dozens of Prefabs and ⚡UNLIMITED POWER!⚡

Discussion in 'Assets and Asset Store' started by jjxtra, Apr 25, 2016.

  1. mlaibow

    mlaibow

    Joined:
    Feb 5, 2014
    Posts:
    39
    I am trying to have 18 lightning spheres in my game. If I put in 18 of the LightningBoltShapeSpherePrefab all set to multithreaded with generations set to 4, it adds close to 200 SetPass calls per frame. With multithreaded off this completely cripples the game, with multithreaded on, it works somewhat, but still cuts the frame rate in half.

    Am I missing some kind of batching setting? Any suggestions for how to get that many lightning spheres working?

    Thanks.
    -mat
     
  2. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    20
    Hey is there a way to simulate a few frames of lightning manually on start? I want that the lightning spheres apear prewarmed like my particles?
     
  3. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    18 spheres is a LOT of lines, probably many hundreds of thousands. You can either lower the generations, increase the interval and/or lower the amount of emission per frame. Failing that, I would suggest to use the lightning sprite sheet and pre-generate an animated sprite sheet. The is a demo scene in the asset that can do this. Let me know if you need more guidance.
     
  4. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    You could set the position of the transform way far away for a few frames and then move it into the correct position. I know it's a hack but that's the best option currently. If/when I implement this I will likely do something similar.
     
  5. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    I'll be adding LOD capability in the future to also help with rendering.
     
  6. mlaibow

    mlaibow

    Joined:
    Feb 5, 2014
    Posts:
    39
    Thanks for your reply. LOD capability would be great, as the full lightning effect is not necessary on distant objects.
    Actually, maybe I should try a quick version of that and lower the generations depending on the distance to the camera.

    In the meantime, I will give the spritesheet generation a try.
     
  7. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Version 2.4.3 is now live in the asset store!

    LOD property is now available on the lightning bolt script. I've also gone through and reduced GC allocations, especially for spline lightning.
     
  8. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    I've send an LOD bug fix that will fix some edge cases with forks and generations being wrong. Version 2.4.4.
     
  9. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Procedural Lightning now supports LWRP and HDRP! This is version 2.5.0. Enjoy!
     
  10. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    31
    @jjxtra Hi, how do you access the lightning properties in a script.
     
    Last edited: Apr 15, 2019
  11. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    You can access lightning properties easily, see the demo scripts for an example, especially demo scene configure script.
     
  12. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Procedural Lightning now has an upgrade to Weather Maker, if you own procedural lightning but not Weather Maker, you can upgrade minus the price you paid for procedural lightning
     
  13. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    66
    I've dragged the LightningBoltPrefab into the scene and set it to manual mode but after a random amount of time it just destroys itself - what could cause this to happen?

    Thanks
     
  14. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Sounds like you've set a value in the destroy after property
     
  15. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    66
    Is that something you can set in the inspector? The only code I have added is

    lightning.Trigger(.5f);

    Thanks again
     
  16. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Yes there is a property in the inspector
     
  17. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    66
    oh, Life Time. I thought that was for something else. Thanks
     
  18. ash4640

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    59
    I already own your Weather maker asset, nice asset
    - does this work with Weather maker
    - Also, weather maker is heavy for a 2D game, so I'm using your rainmaker so can this procedural lightning do 2d
     
  19. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    Weather Maker already has lightning and is not compatible with either the lightning or rain maker asset.
     
  20. ash4640

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    59
    ok thanks, but part of my question was since I use weather maker only for 3d games
    1. for 2d I'm using just rainmaker and is it compatible with Lightning
    2. also does lightning asset work in 2d (since I'm planning to purchase for 2d game I'm asking)
     
  21. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,190
    1] No, not compatible
    2] Yes works in 2D
     
unityunity