Search Unity

[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:
    40
    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. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    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.
     
  3. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    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.
     
  4. jjxtra

    jjxtra

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

    mlaibow

    Joined:
    Feb 5, 2014
    Posts:
    40
    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.
     
  6. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    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.
     
  7. jjxtra

    jjxtra

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

    jjxtra

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

    FreeReignPublishing

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

    jjxtra

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

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    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
     
  12. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    112
    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
     
  13. jjxtra

    jjxtra

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

    BigGameCompany

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

    lightning.Trigger(.5f);

    Thanks again
     
  15. jjxtra

    jjxtra

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

    BigGameCompany

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

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    66
    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
     
  18. jjxtra

    jjxtra

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

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    66
    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)
     
  20. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    1] No, not compatible
    2] Yes works in 2D
     
  21. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    The mesh script might work for you. There is a demo scene showing the lightning on meshes.
     
  22. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    Hi, purchased this one and it is a great asset. I am using it in an HDRP project and everything works really well but the lights. I have the intensity cranked up, but no lighting is showing in my scene. Any thoughts? Here are my light parameters.

     
  23. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I am going to guess I am not doing the lights property for hdrp, I will need to look into that...
     
  24. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    Thanks! Glow effects look great btw.
     
  25. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    Hello again. I think can create my own animated lights for my HDRP project that trigger with the lightning.

    I also wanted to ask about the noise that you are using. I am trying to get a more fluid effect. I have had some success by turning turbulence, forks, and jitter to zero and turning chaos down to a lower number, then ramping up generations to the maximum. It is close to what I am trying to achieve.

    Is there a way to control the noise scale and/or the speed at which the noise animates?
     
  26. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    That's the best way currently. I could look at adding more parameters to make the jitter more noisy rather than simply side to side, but it is not available currently.
     
  27. MonkeyPuzzle

    MonkeyPuzzle

    Joined:
    Jan 17, 2016
    Posts:
    119
    Being able to adjust the noise scale would be a nice feature.
     
  28. DamirS

    DamirS

    Joined:
    Aug 28, 2013
    Posts:
    19
    Hiho,

    longtime Lightning user here - great Product! :) I started a Fresh project with 2021/URP/Steam/OpenVR and see that OpenVR has only the Instanced Option on SIngle Pass. The result is that Lightning is visible only on one eye. Can i do something about that ?
    Also i got a building error :
    Shader error in 'Custom/LightningBoltShaderMesh': undeclared identifier 'sampler_CameraDepthTexture' at line 152 (on d3d11)

    yours
    Damir
     
  29. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Hello. I am not sure on the VR issue, I don't support VR for my assets anymore due to difficulty and number of devices. I will look at the shader error. Totally understand if you want a refund, just email support@digitalruby.com with your order #.
     
  30. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Also, I don't support 2021 yet.
     
  31. Cerzi

    Cerzi

    Joined:
    Dec 28, 2014
    Posts:
    12
    Having issues with lightning working fine in editor, but not showing at all in build. Project uses Addressables for a bunch of other stuff, perhaps that is causing some issue?

    update: fixed this, the main camera was not set in the inspector, which wasn't an issue if running the scene directly but silently fails in build if loading in from another scene - possibly only due to additive scene loading mode and may not be a problem in normal scene loading.
     
    Last edited: Feb 24, 2021
  32. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I don't see the shader error in a blank project with just procedural lightning, Unity 2020.2, do you?
     
  33. DamirS

    DamirS

    Joined:
    Aug 28, 2013
    Posts:
    19
    Hi jixtra,

    thank you for the answers. I saw that i mispelled my Unity Version. Its 2020.2.4f1 ;)
    I understand about VR - sorry to hear that.
    My setup of Unity is with the OpenVR - it seems this triggers the error somehow.

    No Refund - i used that Plugin on several Projects successful ;)
    Have to find an alternative now for VR.
    cheers
     
  34. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I sent an update that tries to support instancing and stereo rendering, let me know if it helps at all.
     
  35. AngelKraft

    AngelKraft

    Joined:
    Oct 31, 2019
    Posts:
    1
    Great asset! Can you tell me how to disable this debug warning message that I don't need?
    "Lightning bolt script is in manual mode. Trigger method must be called."

    Thanks!
     
  36. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Comment out line of code with //
     
  37. drbatuira

    drbatuira

    Joined:
    May 4, 2020
    Posts:
    23
    Hi how are you?

    I had some doubts:
    2021 is not yet compatible, but will it be in the future?
    Can you tell what doesn't work in 2021?
    Does the URP work normally or does it have any specific restrictions?

    Thanks in advance.
     
  38. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I don’t support beta unity at all. URP should work just like standard pipeline.
     
  39. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    All render pipelines are supported.
     
  40. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    I think it's how light values and exposure are calculated in HDRP - I've been struggling with this myself.

    If I modify line 220 of LightningBoltDataStructures.cs and crank up the max range of LightIntensity to a crazy amount I can get the illumination to work. I very much doubt this is the correct way to fix it, but I hope it helps. :)
     
  41. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    That makes sense. I think hdrp is in lumens. So probably just need a multiplier for another light setting to allow easy adjustment. I’ll add it in the next update.
     
    OdderOtter likes this.
  42. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    You're the best. :)
     
  43. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    Suggestion: it might be
    Thank you for the fix, it's looking much better now!
     
  44. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Hi, I'm evaluating to purchase this asset; I'm using Game Creator to develop my project: do you know if this asset can is compatible with Game Creator and if to use it properly do I need to have scripting skills? Thanks.
     
  45. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I would assume so. I’ve not done any explicit integration, but if game creator can call script methods you should be good.
     
  46. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Thanks, I saw the tutorial linked from the Asset Store: is it still valid? I saw it's been made in 2015 so I?m asking. Thanks!!
     
  47. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    It’s probably still valid but maybe a little different. Feel free to ask any questions as you get into it…
     
    tomobiki likes this.
  48. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Thank you. I'm going to use this asset to make the player and other characters able to cast lighting spells. I read in the description of the asset that it comes with a spell system.
    I'd like to know better how does it work: if it uses the component that has to be added to the camera of if works in a different way.
    Thanks.
     
    Last edited: Nov 3, 2021
  49. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    No camera component. Just a prefab and some script methods to call.
     
  50. tomobiki

    tomobiki

    Joined:
    Sep 27, 2020
    Posts:
    65
    Ok, you convinced me :) I'm buying it right now (taking advance of the discounts!!)