Search Unity

Volumetric Light Beam - Volumetric Lighting solution compatible with Mobile, VR and WebGL

Discussion in 'Assets and Asset Store' started by techsalad, Oct 9, 2017.

  1. aleksandarpopovic

    aleksandarpopovic

    Joined:
    Jun 1, 2018
    Posts:
    4
    First of all thank you for making this great asset.

    I have a problem with moving light... if you set 3d noise speed 0 the noise become static, but if you move a light noise seems to move... is there a way to make 3d noise move with light? so it stays static even if the light moves?
     
  2. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi and thanks.
    You are right, when you move the beam, the noise effect seems to moved too because it's static in world space. But I could definitely add an option to make it static in local space so it will look like you expect.
    TS
     
    aleksandarpopovic likes this.
  3. aleksandarpopovic

    aleksandarpopovic

    Joined:
    Jun 1, 2018
    Posts:
    4
    please if you can :)

    I've tried to calculate velocity of object and than control the velocity vector of noise to invert of velocity and it works but it's jittery
     
    techsalad likes this.
  4. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    I made a prototype of this feature. I can send it to you so could give it a try and give me some feedback. Please send an email.
    Thanks
    TS
     
    Lars-Steenhoff likes this.
  5. aleksandarpopovic

    aleksandarpopovic

    Joined:
    Jun 1, 2018
    Posts:
    4
    Thank you very much, I've sent you my email on PM, I'll try it out and post results :)
     
  6. DHARMAKAYA

    DHARMAKAYA

    Joined:
    Dec 1, 2014
    Posts:
    59
    Hi,

    Is that functioning on android, such as gear vr? BEEN WAITING MORE THAN A YEAR since a Unity employee pretending to be a programmer promised post processing stack v2 support for single pass stereo mode. And yes, he promised it would have been done a year ago or so, but that's what Unity gets for importing cheaper, low quality, lying employees from india.
     
    Endi24 likes this.
  7. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Unfortunately it's still not fixed by the Unity team. Here is the issue I reported, which is still active: https://issuetracker.unity3d.com/is...th-vr-single-pass-sampling-cameradepthtexture
     
  8. DHARMAKAYA

    DHARMAKAYA

    Joined:
    Dec 1, 2014
    Posts:
    59
    There is a long complaint thread about this on github since 2016 or so I think.
     
  9. DHARMAKAYA

    DHARMAKAYA

    Joined:
    Dec 1, 2014
    Posts:
    59
  10. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    trying to use this plugin with the Oculus Quest. I'm using just the center anchor camera. For some reason, the volumetric light only shows up on one eye. Any ideas?
    I'm using Single Pass. Unity 2019.1.3f1
     
  11. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi and thanks for your message.

    Which "Stereo Rendering Method" are you using?
    Screenshot_19.png

    Because it's a known issue of Unity: The depth sampling is broken for the right eye when Single Pass stereo mode is enabled on Android.
    More info here.
    Let me know.
    Thanks
     
  12. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    That solved it. Thanks! I didn't notice that in the trouble shooting section.
    Yeah I was Oculus, Android, Single Pass. I set the opaque geometry to 0 since keeping single pass is important.
     
  13. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Glad it worked, thanks for the feedback!
    Don't forget to add your vote to the Unity issue tracker, maybe it will be fixed someday... (and a review on the asset store if you like the asset :)).
    Thanks!
     
    jashan likes this.
  14. afshin_a_1

    afshin_a_1

    Joined:
    Apr 26, 2015
    Posts:
    52
    We really appreciate your understanding of the performance. Do what is better on performance side.;)
    but you promised us 2 years ago about supporting rectangle shape to simulate volumetric area lights like windows etc. seriously when can we achieve this?
    also i just figured it out that i can't achieve "fading out beams according to the camera's distance" based your documentation. Have you deleted this feature?:eek:
     
    Last edited: Jul 23, 2019
  15. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi :)
    Regarding the "rectangle shape" feature, I feed quite bad about mentioning it so early without being able to release it yet. Since the time I created this video, SRP happened unfortunately (for me!)... and supporting it is quite a nightmare: because it's still an experimental feature, it requires a lot of testing, bug fixes and time. Anyway, I can send you an early version of the rectangle shape feature if you want to give it a try.
    Regarding the feature "fading out beams according to the camera's distance", it's has been released in version 1.64: it's called fade out.
    Thanks
    TS
     
    hippocoder likes this.
  16. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hi,

    Any idea why I keep getting this message? It seem to be random. I am on 2019.12, but it was happening since 2019.7 (just been ignoring it since it was not breaking the game and only shows up in the Editor)

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.GameObjectInspector.ClearPreviewCache () (at C:/buildslave/unity/build/Editor/Mono/Inspector/GameObjectInspector.cs:211)
    3. UnityEditor.GameObjectInspector.OnDisable () (at C:/buildslave/unity/build/Editor/Mono/Inspector/GameObjectInspector.cs:199)
    4. UnityEditor.AssetDatabase:DeleteAsset(String)
    5. VLB.MaterialKeywordSRP:Delete(Shader) (at Assets/Plugins/VolumetricLightBeam/Scripts/MaterialKeywordSRP.cs:64)
    6. VLB.Config:OnRenderPipelineChanged(RenderPipeline) (at Assets/Plugins/VolumetricLightBeam/Scripts/Config.cs:160)
    7. VLB.Config:OnEnable() (at Assets/Plugins/VolumetricLightBeam/Scripts/Config.cs:242)
    8.  

    Thanks!
     
  17. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Yes it's a bug I already fixed and the fix will be included in the next version. Please send me an email, I could send you the updated version.
    Thanks
     
  18. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    has anyone able to make VL work with LWRP and Arkit? I'm facing issues with it. It's working fine in Android but in iOS it doesn't show up. thx
     
  19. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    last time I tried on my iOS device, I couldn't reproduce the issue. Could you please provide me more info about the LWRP package version, the ARKit version and the Unity version you are using?
    Thanks

    EDIT: Just saw you updated your review with this info: ARFoundation preview2 2.1.0, ARKit XR Plugin preview3 2.1.0, LWRP ver 5.13.0, Unity 2019.1.0f2. I will try with this setup. Thanks
     
    Last edited: Jul 31, 2019
  20. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    k thx.
     
  21. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    How soon you would be able to check and confirm?. As I'hv some demo lined up for my product so need to resolve this quickly. thx
     
  22. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hey,

    I should be able to test next week (I am usually able to check issues reported by users much quicker, but iOS is another story...). But I can't guarantee I will be able to reproduce it, since last time I tried I didn't manage to. On which iOS device do you have the issue btw?

    In the meantime, maybe could you give a try to the freshly released version 1.72 of the plugin, since I fixed a bug related to SRP in it.

    Otherwise, have you tried to disable the soft blending with opaque geometry (set it to 0)? It usually helps since getting access to the depth buffer is a regular problem:
    http://saladgamer.com/vlb-doc/comp-lightbeam/#opaque-geometry

    Thanks
     
    Last edited: Aug 2, 2019
  23. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    ------

    Devices tested on - Iphone X, iphone 6s , ipad
    yes, I tried with version 1.72 but it didn't work. Also, I tried - disable the soft blending with opaque geometry (set it to 0), this also doesn't work. Can you take a look at it on priority as my whole module is on hold because of this issue? thx
     
  24. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hey,
    Thanks for the info. So I spent a couple of days testing various combinations. The closer I could get to your setup was using Unity 2019.1.13f1, LWRP 5.13.0, ARKit XR Plugin 2.1.1. I ran a test project on my only ARKit compatible device which is an iPhone 5 SE with iOS 12.4. But still couldn't reproduce the issue... So I think there is only 2 options: either I am not testing with the proper iOS device, or there is something in your project which makes the plugin buggy.
    I will look to buy a more recent iPhone to be able to test with more different devices. In the meantime, do you think it would be possible to send me your project (or a subset of it which highlight the issue you are encountering), so I could test with the exact same data?
    Thank you very much.
    TS
     
  25. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Hi @techsalad -- I had a problem recently whereby my UI masks glitch out when under a beam. Is this a known issue, or is there a quick fix? I've not dug too far into yet, thought I'd ask first. Bearing in mind I'm still running the test version you sent me a while back that supports the square shaped beams.

    // WildStyle
     
  26. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    No it's not a known issue, but I haven't particularly tested with UI masks. Thanks for the report I will give it a try and let you know.
    Thanks
     
    WildStyle69 likes this.
  27. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    thx for a quick reply. My project (subset) is quite big to send; would it be possible for you to share your test project so that I can see the settings at my end replicate the same in my project. best,
     
  28. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    I think I found the issue which should be very specific with the version of the plugin you are using. In this version, I use the stencil buffer a lot, and the UI masks use it too. So depending on the depth of the UI masks hierarchy you have set, it might clash with the stencil ID range used for the beams. By default the range is between 5 and 255, but it can be changed in the config file. Try to increase the min bound (for example between 20 and 255).
    Screen Shot 2019-08-09 at 19.51.29.png

    Please let me know if it helps.
    Thanks
     
    WildStyle69 likes this.
  29. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    This makes sense, thanks for great support.. appreciated.

    // WildStyle
     
    techsalad likes this.
  30. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    Is it possible to just have the shaft without using the light component? All I am interested in is to be able to use the shaft itself and through shader magic use that to fake lighting.
     
  31. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Yes of course, having a light component is not mandatory. You can simply add a VolumetricLightBeam component to any GameObject, with or without Light. More info here: http://saladgamer.com/vlb-doc/#create-your-first-light-beam
    Thanks
     
    Nyanpas likes this.
  32. afshin_a_1

    afshin_a_1

    Joined:
    Apr 26, 2015
    Posts:
    52
    hi @techsalad . thanks for your great communication here. i wanted to know if you have any plan for issuing this problem:
    Annotation 2019-10-07 112633.jpg
    changing the angle of beam without loosing the begining of the geometry shape. this is essentially a basic feature. it would be good to see it. thanks again.
     
  33. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Thank you for the suggestion. Indeed, it would be great, I will definitely investigate to add this feature.
    Would you need this feature to be compatible with the "cap geometry" too? Or would it be enough if it works only for the "side" geometry?
    Thanks
    TS
     
  34. Nintenjo64

    Nintenjo64

    Joined:
    May 19, 2015
    Posts:
    12
    In your initial scope it mentions it only works work a Spotlight.. does this mean it will work with a spotlight that has an angle less than 180 degrees? I am considering using this plugin with light Strip lights where the bulb its outside the wall its attached to so i need a rectangular source with an angle of around 270 degrees?

    Thanks
     
  35. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Yes the plugin only works for spotlights with angle lower than 180 degrees. I am not sure it's even called a spot light when it has a greater angle anyway.
    TBH the lower the angle, the better the effect of the volumetric beam.
    Cheers
    TS
     
  36. TAFEDigitalLab

    TAFEDigitalLab

    Joined:
    Jul 12, 2018
    Posts:
    2
    Hi there,

    Firstly love the VLB asset - works really well and saved me and my team days/weeks of work for a VR lighting education project we are working on :)

    I am wondering if it would be difficult (or possible at all) to use a custom mesh for the light beam geometry? What I would be after specifically is to have a custom mesh with blendshapes so that I can modify the shape of the mesh to match a 'barn doors' rig I have created for a spot light. I have basically added 4 pieces of geometry (cubes) that are only visible as shadow casters and can be rotated independently to block the light from the top, bottom, left and/or right of the light. This creates a barn door effect by squaring off the light on the sides.

    This works with your light beams mostly if I control all 4 at once (and slowly remove sides from the light beam geo) but if I wanted to control them 1 at a time the light beam wont match the spot light shape. If I could use a custom mesh for the beam and adjust it's blendshapes through the same script that rotates the objects though I could achieve this result :)

    Cheers,
    TLD
     
    Last edited: Oct 11, 2019
  37. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,

    Thank you for your feedback.

    I already thought about allowing to use a fully custom mesh instead of a cone, but I don't think I will do that. I wouldn't be able to control the normals of the mesh in order to make sure the result is satisfying enough. In addition it could easily lead to meshes with a lot of polygons which would kill the performance, and I would have way less room for optimization.

    I am not sure to understand what you are trying to achieve. Maybe adding some screenshots would help. Feel free to reach me by PM with more info.

    Thanks
    TS
     
  38. dimib

    dimib

    Joined:
    Apr 16, 2017
    Posts:
    50
    Hey together, this asset looks really nice. Is there a way to run it with the URP (Universal Render Pipeline, LWRP successor in Unity 2019.3) on Unity 2019.3 (beta) ?
     
  39. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Yes the plugin works totally fine with the URP and with the latest alpha & beta versions of Unity. URP is basically the same thing than LWRP. But I will update the documentation to make it clear.
    Cheers.
     
  40. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi there!

    Still waiting for the away-from-source particles update! :D

    Here's a teaser (the client, the museum of Florence, took the footage from a nightly build, the video quality isn't great) of The Medici Game. Murder at Pitti Palace, a Resident-Evil mood inspired/narrative/puzzle-game I've been leading for a few months so far - it's a 3-months development game - the crunch time! -, and today's the launch day of the first 3 (way too rushed and verbose for my taste) chapters :)
    (but it's been a rushed launch, the actual full game will be available in a few months - with not-rushed features and polish - being brutally honest here :p )

    And, I'm so glad Volumetric Light Beam was available, it's running as a charm on mobile, thanks for developing it! <3


    Press conference is almost ready ^_^

    As you can see from the (pretty bad quality) video, this asset had great part in building the atmosphere of the game, I can't recommend it enough! ^_^

    Just curious, is there a way to make the volumetric cones to appear in the reflection probes? So far I used some fake sprites to simulate the cones on the reflection probes.

    I'm so looking forward the next update! :)
     
  41. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Yes, I still didn't have the time to release the update. I will try to do it ASAP.
    About the reflection probes issue, I wasn't aware. I will investigate.
    Thank you very much for the feedback. The game looks great, it's incredible that you were able to do it in such a short time frame!
    Thanks
     
  42. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Hi @techsalad,

    Not sure you can help, but I'll ask in the hope you can. :)

    I had an issue with the light beam geometry interfering with the Unity UI mask before. You pointed me in the right direction and I was able to fix it at that time. Since then I've added an anti-aliasing solution to my project which means that I've had to move the UI to a second (stacked) camera to keep it legible. So if the light beams are left on the first camera that same UI mask problem comes back. To solve it I can move the light beams to the second camera too.. however now the beams visibly intersect when they hit geometry (as they are now rendering in a second camera / order I suppose).

    Wondering if you can think of a way around this issue? Appreciate any pointer, thank you.

    // WildStyle
     
  43. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Hey there - figured my issue out already, thanks!

    // WildStyle
     
    techsalad likes this.
  44. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Glad you managed to solve it! I am just curious about how you manage to do it.
    Thanks
     
    WildStyle69 likes this.
  45. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318
    Thanks @techsalad !

    Solution was actually really simple, which is often the ones I overlook! Changed the Mask component to a RectMask2D, which works just fine for my use-case and does not use the stencil buffer.
    https://docs.unity3d.com/Manual/script-RectMask2D.html

    // WildStyle
     
    techsalad likes this.
  46. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    So I investigated the issue related to reflection probes.
    The light beams won't appear in probes with type set as "baked", because in this case only the "static" GameObjects will be captured.
    Screenshot_36.png

    The beam geometry is not static because procedurally generated.

    You can force the Volumetric Light Beam GameObject with its children to be static, it will set the beam geometry as static too until the next time it's generated (for example the next time you press play), and so if you capture the reflection probe right after that it will work.
    Screenshot_37.png

    However it's far from ideal, and I could probably apply the same static flags to the beam geometry than to the Volumetric Light Beam GameObject. I will give it a try and make you a custom version if it works,

    Thanks
    TS
     
    NeatWolf likes this.
  47. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Thanks!

    I was assuming that since they showed up in the editor, so they should also show up in the baked probes :D

    Truth is: I'm mostly using the volumetric lights as static. Even to fake up some ground fog/myst :D

    I have one issue-non-issue.

    There's a scene where I actually need the cone to not be static and... it's a problem since it's a flashlight and it intersect with the ground.

    I'm not sure about how to solve this. I don't wanna use glare or flares, the camera is mobile both in angle and position, the spotlight is linked to a man struck with convulsions. The floor is clean white marble.

    And, well, I was wondering if you have any trick to handle this case, without bogging down performance:
    (it's a flashlight pointing straight up to the camera. Almost)


    Of course it would be natural to have the bottom part filled with light as well.

    I was wondering if a solution could be: setting the intersection smoothing to 0, and adding blending clipped part so that it's only a factor of the whole intensity (let's say, 0.5f).

    I understand it's a bit of a corner case scenario, but, maybe, rendering the whole cone as overlay and applying a diminished intensity version of the shader to the clipped parts could solve, without compromising speed too much, the issue with cones visible only partially.

    The other solution would be to compute a triangle in realtime, and doesn't seem very viable :D

    Or, the shader could completely ignore geometry and render on top of most geometry (fading close to the camera as usual) when the camera is inside the cone looking toward the center (using dot product should be fast enough), and normally when seen from the outside.

    Just a few ideas :)

    Do you have any quick hint to share to alleviate this?
    Here are a few more reference pics, to better explain the issue (my issue, the asset is working exactly as predictable. Maybe it's a feature request?)

    I'm also appreciating it as a solution for thin ground fog. Since the shader is in world space, you can squash/squeeze/non-uniform-scale the cone as a cylinder, or an approximated plane, always using the shared mesh (well, scaling it should break batching, but whatever, it's tremendously fast compared to other solutions - I could even multi-layer it!)

    I believe the shader already support every kind of shape at the moment.
    Why not give some official support to other shapes as well?
    Such as, mist patches, foggy volumes, and, something that I know goes a bit beyond the current implementation: baking spotlights so that they generate a cutout mesh, such as rays coming out of a grid-glass window, or touching the silhouette of a statue? (baked only)

    I know it's probably a different tool, but asking never hurts. :p
     
  48. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Thank you for your suggestions.

    The rendering issue you are encountering is a limitation caused by the technique used by the plugin to draw the beams. This is definitely something I plan to improve, but it's not an easy task.
    I am not sure how your suggestions could fix the problem. I plan to fix it by adding multiple planes orthogonal to the beam direction, so there would be always some piece of geometry placed in front of the camera. But it involves a lot of changes in the shader code, as well as some optimization challenge.

    Regarding your other question, the shader code only supports come geometry and is not designed to render ground fog. The result is not satisfying with other shapes. So it's fine if you managed to use for other purpose, but I doubt it would provide a nice quality in all cases.

    Thanks
    TS
     
  49. GrassWhooper

    GrassWhooper

    Joined:
    Mar 25, 2016
    Posts:
    109
    hey, so i have like, bought your asset
    my target platform is android, i use IL2CPP + 64 + 32 bit with 2.0 standard of dot net.
    i use unity 2019.2.17f1
    when building, i keep getting this error (it does not stop the build process), any ideas?
    note i am using linux editor: as in: linux mint 19.2
    one of the main reasons i grabbed the asset was the multi platform support, i really hope this is not an issue


    upload_2019-12-30_20-25-16.png
     
  50. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    380
    Hi,
    Sorry for the issue you are encountering. That’s very strange but it reminds me import issues. Please try to reimport the asset from scratch by following these steps: http://saladgamer.com/vlb-doc/troubleshooting/#errors-after-updating-the-plugin
    Please let me know if it helps.
    Thanks
     
    GrassWhooper likes this.