Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Procedural Lightning Thread. Ask all your questions or show off your games here!

    --> Download Procedural Lightning From the Unity Asset Store <--

    Procedural Lightning and Thunder is an optimized drop in solution for lightning, electricity, thunder effects and even general line effects in your Unity project or game.

    This isn't any ordinary lightning. Using an innovative shader that allows fading in and out, growth, billboarding and glow entirely on the GPU in one draw call, this lightning will run great on mobile and desktop alike.

    You will get 5x CPU improvement and 10x LESS draw calls vs. the Unity line renderer, allowing you to show lightning even on low-end mobile devices. All lightning renders and updates on the GPU! There is even an option to generate the lightning on a background thread, freeing your main thread for other tasks.

    Most other lightning solutions use the Unity line renderer which doesn't batch and has high CPU usage, especially for something with lots of lines and glow like lightning. Think of billboarding and coloring every line on the CPU every frame. YUCK! With this asset, the graphics card takes care of that so your CPU can do more important tasks.

    Supports perspective, orthographic and orthographic xz planes.

    I've added a nice spell system with force lightning, lightning beam, lightning ball, charged bolt and lightning whip. Easily extensible and customizable.

    If that weren't enough, you also get 17 high def thunder sounds. I've literally spent weeks on end of my life making this the best lightning in the asset store, and I know it will serve you well.

    Here's the full run-down on what Procedural Lightning and Thunder for Unity can do for you:

    - A configuration scene to help you get the exact look you want for your lightning. Tweak the detail, width, glow, duration, chaos, forkedness, direction and much more. Bolts can be randomized with a seed to get the same bolt.
    - One click to get the exact code and script to reproduce your lightning bolt.
    - Manual and automatic mode for the script. Trigger your customized prefab manually or let it run automatically.
    - A robust lightning script that lets you create lightning strikes with a large selection of parameters with near infinite possibilities.
    - Lightning works great in many scenarios: thunderstorms, magic spells, static discharge and much more!
    - Lightning branches fade in, jitter and grow to make your lightning really come alive.
    - Storm cloud particle system that looks stunning when lit up by lightning.

    I've also included a more high level script if you just want storm lightning in your game without having to configure very much stuff. This script contains:

    - Normal and intense lightning strikes with appropriate brightness, thunder delay and thunder volume.
    - Cloud only lightning option.
    - 17 distinct thunder sounds.
    - Random range of time for the next lightning strike.
    - Option to illuminate the skybox when there is a lightning strike.
    - Random range of lightning intensity.
    - Force a lightning strike via script.
    - Lightning centered around the main camera by default.
    - Option to try and make sure every lightning strike is visible by the camera.
    - Dark cloud particle system for storm clouds.
    - Demo scenes showing some terrain and water with the ability to call lightning with keystrokes. Procedural Lightning for Unity also contains an advanced lighting system that allows you to generate point lights along the paths of your lightning for that extra realistic effect.

    This asset contains a batch of prefabs to create lightning bolts, sphere lightning, cone lightning, lightning fields, arcs of electricity and chain lightning. 17 high def thunder sounds, as well as a storm cloud particle system that looks amazing when lit up by lightning, are also included. You can even seed your lightning to get the same appearance.

    Don't spend time making lightning effects yourself from scratch. Save yourself time and money with this powerful yet easy to use plugin.

    This asset is demonstrated in a HereVR sci-fi pack video, viewable from here: http://u3d.as/guN

    Games using procedural lightning: - Doomwheel

    Please read the Readme.txt file to get the most out of this asset. I am available at jjxtra@gmail.com to answer questions and help you out.

    Best wishes for you and your project.











    --> Download Procedural Lightning From the Unity Asset Store <--
     
    Last edited: Nov 27, 2017
  2. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Hi @jjxtra,

    Really like the assets of yours I have tried up to now. Just a question on the rain system you have. I tried the free version and added a standard cube with collider to the scene and noticed that rain was passing through the object. I added a rigidbody and still the same. Is there a way of configuring scene objects to stop rain etc passing through? If so is it also the case for your full weather system pack?

    Thanks

    doc
     
  3. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Dev replied via email. Thanks for the help.
     
  4. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hey, @jjxtra
    I have bought your asset, but I can't do one thing.
    I have a level map and I want to connect level icons with the lighting effect.
    So each unlocked level gets lighting connection:
    Screen Shot 2016-06-15 at 7.50.28 AM.png
    I've set my level completion stars (rhombus in my case) as Lighting Path points in LightingBoltSplinePrefab
    but even when stars game objects are disabled, lighting is still being generated.
    On the above screenshot you can see that level 15 is locked and stars are hidden, yet lighting is there.
    Is there a way to use only active game objects in a lighting chain somehow?

    And another quick question: how do I make my lighting to draw behind the asteroids mesh?
    I've created a sorting layer
    Screen Shot 2016-06-15 at 7.57.42 AM.png
    and set Lighting to use it, but it's still in front. any advice on that?

    Thank you
     
    Last edited: Jun 15, 2016
  5. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Hi,

    Thanks for this plugin.
    I'm having trouble using it in front of a MeshRenderer.


    As you can see, the lightning is not visible when in front of a white MeshRenderer.
    I tried setting the MeshRenderer material to Unlit and it happens when the color is white ; and to Standard and it happens when the light is intense enough to make the renderer white.
    Am I doing something wrong in the setup?


    Thanks!
     
  6. docsavage

    docsavage

    Joined:
    Jun 20, 2014
    Posts:
    1,020
    Can't help with your questions sorry but when I have emailed the dev he has always answered quickly. Not sure if he is aware of these posts. May be worth sending him an email via his website linked on the store page.
     
  7. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    lightning you have most likely is using additive shader. there is nothing to add when background is already white.
    You need alpha-blended shader instead of additive. but I don't know if this asset has one
     
  8. Arkasis

    Arkasis

    Joined:
    Nov 22, 2010
    Posts:
    61
    Hi,

    I want to buy your asset but I have some questions :
    - Is it possible to change lightning colors ?
    - Does it works for VR projects ?

    Thanks
     
  9. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Got your email. Sorry I don't get notified on posts in this forum. I'll try to turn that on.
     
    Almakos likes this.
  10. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Supports VR, changing colors and so much more.
     
  11. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Try changing the blend mode on the script. It should have alpha blend, additive and anything else available via the src blend and dst blend script properties.
     
  12. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hey Jeff,
    Thank you for your reply and fix (however I am still having difficulties making it work^^')
    But more importantly I've tried to build my game for WebGL or HTML5 (iOS works fine) and got this compiler error:
    Any idea what that might be? Can't build game at the moment
    Thank you
     
  13. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Looks like a bug. I have a fix, email me and I'll give you the file to fix it. I'll send an update to Unity too.
     
  14. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Thank you for fixing it. All is good now
     
  15. L-Tyrosine

    L-Tyrosine

    Joined:
    Apr 27, 2011
    Posts:
    305
    I'm having trouble to make it work with camera in Orthographic mode. For example, the DemoSceneMesh scene with ortho camera:

    upload_2016-7-2_14-31-33.png

    And with perspective:

    upload_2016-7-2_14-36-17.png

    How to get rays in front of object as it appear in perspective camera?
    Thanks.
     
  16. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    You should be able to set the sort order for 2D mode.
     
  17. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    Nice plugin!

    I have a question about prewarming the lightning, like you can with the particle systems - is it possible?

    I am using the LightningBoltShapeSpherePrefab which I have added as a child to another game object. The problem is, when I instantiate a new instance of the parent, it takes a second or 2 for the lightning to take it's full form. Is there a way to make it visible immediately?

    Thanks
     
  18. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I am looking into a way to pre-warm and cache the lightning and hope to put this in an update.
     
  19. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    Excellent. Thanks
     
  20. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Hi. Been using the asset for a few days and love it. I'm having a few small issues though.

    For some reason, with Lightning Spline in Deferred with HDR enabled, my spline looks like this:



    It flickers between looking correct and being these big opaque squares. When I turn HDR off, the problem goes away but I need HDR for my game.

    Weirdly, I have Lightning Mesh in my scene and they work perfectly in HDR! Only the Spline seems to be affected by HDR for some reason.

    Any chance you could look into this issue? I really want to use a spline for a big feature in my game but with this bug I can't :(
     
  21. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Certainly, I will investigate. Thanks for reporting the issue.
     
    JonDadley likes this.
  22. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I have fixed this and submitted an update to Unity. Email me if you want the fix faster. It's a few lines change in the shader.
     
  23. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Thank you so much for the quick response :) I'll be leaving a 5 star review on the asset store as soon as I've got it working!

    EDIT: The fix worked perfectly. I've left a 5 start review - thanks for this top quality asset and prompt help!
     
    Last edited: Nov 17, 2016
    jjxtra likes this.
  24. Quiet-Pixel

    Quiet-Pixel

    Joined:
    Aug 23, 2013
    Posts:
    48
    Is there a way to have existing bolts terminate on a fixed location even while the source moves? I have a moving object that is emitting bolts, but I want the bolts to keep ending at a fixed location even as the object moves.
     
  25. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Currently no, the meshes are always children of the prefab, so if you move the prefab, the meshes will move with it. This could be a parameter in a future version in the lightning bolt parameters that specifies whether the mesh should not move with the parent.
     
  26. Quiet-Pixel

    Quiet-Pixel

    Joined:
    Aug 23, 2013
    Posts:
    48
    Thank you, jjxtra.

    I found a workaround. If I set the duration of the bolts short enough, and the period between the creation of new bolts short enough, the end of the bolts appear to stay very close to the stationary end point. As long as everything is tweaked to account for how fast we are moving, it looks correct.
     
  27. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Glad you got a work-around. Let me know if you need more assistance.
     
  28. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    Couldn't you just have the prefab with the lightning script outside of the moving object, and then set the start source to the moving GameObject and the end source to a stationary game object?

    https://www.dropbox.com/s/n62f97nybfqhsol/Screenshot 2017-01-14 22.21.46.png?dl=0
     
  29. Quiet-Pixel

    Quiet-Pixel

    Joined:
    Aug 23, 2013
    Posts:
    48
    I don't think that will work. Each sub-bolt that is generated uses the start and end positions at the time the time they are spawned. After that the sub-bolt moves as a single unit along with the object that has the lightning script on it.

    So, let's say we had a car going down the road with the source attached to it, and a target endpoint sitting stationary along the road. As the car moves it will spawn new bolts from its current position to the target endpoint. But the starting point of each bolt will not continue to move with the car. They will stay fixed relative to the road. The result would be a fan of bolts spread down the road as the car passes.

    If thought, you set the Interval Range and Duration Range values short enough, the bolts will come and go so quickly that you won't be able to tell they are stationary in space.
     
  30. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    For some reason, you asset is generating MANY MANY Drawcalls in my project. I do not know why; those spikes you see in my profiler are each time a "Manually Activate" the lightning.

    I wonder why, Demos produce 1 o 3 draw calls at most.

    I am working on a 2D project, using ortographic camera, XY. Lighting has higher draw order than any other object in my scene; renders at my default camera. Is there a setting am I missing to make your lightning batch in one single draw call, or 3 at the most?
     

    Attached Files:

  31. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    How many bolts are you emitting? You can email me a sample project with the problem and I can take a look.
     
  32. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Only 3 bolts, but when I benchmark in mobile there was no slowdown neither problems, so, no worries.

    Project is kind of heavy, but I will try to reproduce the issue in another project and send it your way.

    Thank you, your asset is great, btw.
     
  33. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Ok. You can always try the new multithreaded property to see if it helps.
     
  34. tjscott

    tjscott

    Joined:
    Sep 22, 2014
    Posts:
    12
    We've found memory leaks in your asset and are wondering if you have done any updates this year to address memory leak issues. We've identified some that we were able to fix ourselves, but there are still more that are proving elusive.
     
  35. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I fixed a lot of these a year or so ago. The script will cache meshes and objects, so you may see memory grow for a while, this is normal. If you are seeing memory grow endlessly that is a problem.

    Can you point me to the changes you made? Maybe share your project? Easiest to do this offline, send an email to support@digitalruby.com.
     
  36. tjscott

    tjscott

    Joined:
    Sep 22, 2014
    Posts:
    12
    We have a version that does the caching, but we still see memory increase forever in one of our scenarios. I will e-mail you with information on fixes we did.
     
  37. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Just FYI all these have all been fixed in the Unity 5.6.1 version of the asset. If you can upgrade to that Unity version it will solve this. The other option is to just copy the scripts from the 5.6.1 version to your asset. There may be some breaking changes in the API if you do this.
     
    Last edited: Jun 21, 2017
  38. klnl

    klnl

    Joined:
    Mar 28, 2013
    Posts:
    1
    Hi!

    I have a problem with glow render queue. It's always render behind the arm, but the main lightning renders in front of

     
  39. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Hi sorry I did not get notified of this post. Are you still having an issue with this?
     
  40. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    I added a bunch of videos in the first post if you want to see some examples of this being used in games and demos. Just scroll all the way up! Thanks for visiting, and enjoy unlimited power!
     
    Last edited: Nov 18, 2017
  41. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Procedural Lightning is on sale now for 30% off. Get it while it's hot!
     
  42. KBossler

    KBossler

    Joined:
    Mar 8, 2017
    Posts:
    6
    I'm having an issue with the lightning bolt path prefab. I have an energy beam that I want my character to be shooting out with an outline of lightning. I got the look I want (first image) but the problem happens when the character rotates quickly the beam follows but the lightning lags behind. The object hierarchy is as follows:

    Beam
    ----LightningBoltPathPrefab
    --------Point_0
    --------Point_1 etc..

    I've tried adjusting the duration, interval, speed and even the number of points around the beam object. Any help or suggestions would be greatly appreciated.
    Screen Shot 2017-12-19 at 3.02.31 PM.png Screen Shot 2017-12-19 at 3.07.17 PM.png
     
  43. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Look at the demo scene that rotates, scales and translates the lightning to keep it anchored to two transforms. Let me know if you can't find it.
     
  44. KBossler

    KBossler

    Joined:
    Mar 8, 2017
    Posts:
    6
    Thanks, I found the scene you were talking about. And that appears that the LightningBoltTransformTrackerScript is close to what I need. However the script only allows for a start and end point whereas the lightning path I have set up uses 6 points.

    So is it possible to add points to the script, or do I need to set up several of of these start and end points with multiple scripts tracking them? The latter seems like it would be a performance hit as the game I'm making is for mobile.
     
  45. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Multiple points are unlikely to work well as the lightning really would just need to regenerate the mesh. You could try reducing the life time of the lightning and increase the rate at which it is generated to simulate something similar. If you set the generation interval to 0.016 (60 fps) and the lifetime also to 0.016 you might get close.
     
  46. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Procedural lightning is now 9 USD. No other lightning asset comes close on price, feature set and visuals.
     
  47. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Please post any screenshots or videos of your games here, and I will look at putting them on the asset page itself! Great exposure for your game or app.
     
  48. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Just FYI all I am having carpal tunnel surgery today. Going to take a few days off from everything, be back sometime next week.
     
  49. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Hi, is there any way I can spawn the lightning independent of the game's time scale? :(

    This is very important..!
     
    Last edited: Jul 20, 2018
  50. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    1,464
    Somewhere in a LateUpdate function in your scripts do this:

    float t = elapsedTimeSeconds;
    Shader.SetGlobalVector("_LightningTime", new Vector4(t * 0.05f, t, t * 2.0f, t * 3.0f));