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. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Thanks for the response, yes that is a feature i need so I can
    use this for a 2d game I’m making.
     
  2. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Great!
    So I had a quick look at it and it's actually pretty easy to implement. I already have a working prototype :)
    gif3.gif

    So I could definitively add this feature in the next update.

    If you are interested in receiving a WIP version before to try it, send me an email at techsaladunity@gmail.com with your invoice ID, I will be happy to share it with your ASAP.

    Thanks.
     
    Lars-Steenhoff and AthrunVLokiz like this.
  3. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Thank you so much!
     
    techsalad likes this.
  4. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    Hi,
    I purchased yesterday your great asset. Some how I couldn't find out how to change the size of the cone base of the light. I created a volumic spotlight for a my Flashlight but some how the light has more a shape of tube rather than a cone., which could be ok for me, the only problem is that the base is much more bigger than my flashlight.
    I can show a screenshot later if u need.
     
  5. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi and thanks for your message,
    You can customize the shape of the beam using 2 properties:
    - Truncated Radius allows you to change the size of the base of your beam. Tweak this one to make it fit with your flashlight model: http://saladgamer.com/vlb-doc/comp-lightbeam/#truncated-radius
    - Spot Angle allows you to change the shape of the beam, to make it look more like a cone or more like a tube: http://saladgamer.com/vlb-doc/comp-lightbeam/#spot-angle

    Screenshot_40.png

    Do not hesitate if you have more questions.
    Thanks :)
     
  6. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    thanks a lot... will try it later....
     
  7. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    are you able to do circle volumetric lights?
     
  8. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    If by "circle" you mean supporting "point lights" (light going in every directions in 360 degrees), no. The plugin only supports spotlights.
     
  9. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    yes I mean point lights will you support it in the future?
     
  10. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    This is not planned: it's not really possible with the current technique the plugin is using.
    For example doing volumetric point lights without supporting shadowing doesn't make a lot of sense (otherwise it's just a big glow). And supporting shadowing would involve a much more performance intensive process, which would not run on mobile for example.
     
  11. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    ok thanks for the reply
     
  12. Johnny_Jr

    Johnny_Jr

    Joined:
    Jan 23, 2015
    Posts:
    9
    Hi!
    When compiling for PS4 I get errors in the Beam shader (the first one in both frag and vert):

    Shader error in 'VolumetricLightBeam/Beam': Program 'frag', 'sampler2D' does not contain a member named 'Sample' at /Unity/2018.1.0f2/Editor/Data/CGIncludes/HLSLSupport.cginc(519) (on ps4)

    Compiling Fragment program with STEREO_INSTANCING_ON VLB_DEPTH_BLEND
    Platform defines: UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING


    Shader error in 'VolumetricLightBeam/Beam': undeclared identifier 'sampler_CameraDepthTexture' at Assets/Plugins/VolumetricLightBeam/Resources/VolumetricLightBeamShared.cginc(49) (on d3d11)

    Compiling Vertex program with STEREO_INSTANCING_ON VLB_DEPTH_BLEND VLB_NOISE_3D
    Platform defines: UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

    I'm on version 1320 and using Unity 2018.0.1
     
  13. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    I don't have a PS4 devkit to try, but we'll find out the issue. Have you tried to update to the latest 1520 version?
    Thanks
     
  14. Johnny_Jr

    Johnny_Jr

    Joined:
    Jan 23, 2015
    Posts:
    9
    No I haven't, for the simple reason that the game is already out on PC and I don't want to update stuff that works... I'll give it a go and see if it the issue is resolved.
     
  15. JediNizar

    JediNizar

    Joined:
    Nov 13, 2016
    Posts:
    111
    Hi,
    I've discovered something weird.
    the light is going through every surface. first I discovered through a character, then I added a box behind the character and I had the same effect, the light is going through the character and the box. and I'm sure I didn't have the same effect prior adding the volumetric light.. please see the picture below: LightBeamBug.png
     
  16. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    The VolumetricLightBeam component is not supposed to change the behavior of the light itself. You can try to disable or remove the VolumetricLightBeam component (and the DynamicOcclusion component) to check if the issue is still the same without them.
    Please let me know,
    Thanks
     
  17. SF_futurlab

    SF_futurlab

    Joined:
    Feb 4, 2016
    Posts:
    19
    Hi,
    Just been through the forum to see if there's talk of a rectangular beam (which I see there is plenty) - great that it's on its way :)

    In the meantime, I found putting the cone segs to 4 gives you a square beam with the only downside that it is created at 45 degrees so you can't use local scale to create a rectangle.
    Now, if this cone was created with this rotation in mind, I'd have the kind of solution I'm looking for... (window light beams).

    Plugin otherwise is really great! Thanks
     

    Attached Files:

  18. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    You are right, you can make a kind of rectangle beam this way. However I think the quality is not satisfying enough to "sell" it as a real feature. Making rectangle beams with a good quality is not as easy as it sounds, and is in fact quite different than making cone beams.
    However, if it helps you, I could definitely make the beam geometry rotated by 45 degrees by default so you could scale it properly. If you are interested in testing it beforehand, please send me an email at techsaladunity@gmail.com
    Thanks
     
    Last edited: Nov 28, 2018
    AthrunVLokiz likes this.
  19. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Hi, are you able to round out the point of the cone? I'm using this for 2D
     
  20. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    What do you mean? Do you mean having a half-sphere at the point of the light source like that?
    Screenshot_1.png
     
  21. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Yes, thanks for the reply.
     
  22. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    No it's not possible to do that.
    But you should be able to do it by just adding a half-sphere mesh at the light source position.
     
  23. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Can you give me an example of how to do that?
     
  24. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    I will try to make you a scene example. I will contact you by private message.
     
  25. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
  26. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Just purchased the asset and had a go but I am experiencing some issues.

    1. When I set it up in he editor, it all seems to be fine, but when I am in play mode, it seems like the drawing of the beam seems to be weird. It becomes very short and possibly not even drawing the outter pass. In order to view the beam, the only way is to click on the global button and then toggle the "force single pass" check box on or off. It doesn't matter if it is on or not, as long as I click on that check box.

    2. Track changes during playtime - This doesn't work for me. If I turn the play mode off, the values all just go back to what it was before I was in the play mode.

    3. This is probably my fault of not reading the manual before I buy the asset, but partial occlusion was no good for my usage case. :(

    I am using : Unity 2018.3b12. Windows Editor. Linear, Deferred. HDR.
     
  27. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    I am really sorry for the issues you are experimenting:

    1. That is very weird. Are you using a custom SRP, or the default render pipeline (https://blogs.unity3d.com/2018/01/31/srp-overview/ )? Have you tried to export a Windows standalone build to check if the issue is visible?
    I will try to install the exact same Unity version and try to reproduce it. In the meantime, if you can send me your project (or a subset of it) so I can reproduce in better conditions, please not hesitate: techsaladunity@gmail.com

    2. Sorry if it wasn't clear, but this feature is designed to change the volumetric light beam properties at runtime (from script, or from an animation for example). It's not to keep the changes you have made in editor when playing. I hope it makes sense... :)
    However I think this is a very interesting suggestion, and I will definitely investigate to make it.

    3. Like mentioned in the documentation and the asset store page in the limitation part, partial occlusion is not supported yet indeed.

    Thanks
     
  28. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am using just default rendering pipeline.
    As for the tracking changes during playtime, I am sure it must been mentioned somewhere in the document so it is not entirely your fault, but I bet 9 out of 10 people would think it is supposed to be for the inspector .. haha!
     
  29. OlafsOsh

    OlafsOsh

    Joined:
    Jul 10, 2018
    Posts:
    61
    Hey!
    I need something like this for 2D project - I need exactly lightposts, don't you know :] Does Volumetric Light Beam work in 2D as well?
     
  30. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi and thanks for your interest :)
    Yes it works in 2D. You can customize specific 2D properties like Sorting Layers and Order in Layer, like a regular 2D Sprite: http://saladgamer.com/vlb-doc/comp-lightbeam/#2d
     
  31. OlafsOsh

    OlafsOsh

    Joined:
    Jul 10, 2018
    Posts:
    61
    OK then, you'll have a new customer soon then :]
     
  32. mehrankan

    mehrankan

    Joined:
    Apr 12, 2015
    Posts:
    61
    hi this looks great, I am wondering if I can fake sun-shafts with this somehow, I work in VR so true volumetrics are off the table, which makes this the perfect way.
    a good example can be the light shafts at the top of this image.
     
  33. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi and thanks for your interest. Simply put, no it won't work. The asset is mainly design to simulate volume on spot lights. The result won't be good to simulate directional light like that.
     
  34. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Can't we use the noise texture within the beam? to fake directional light coming to the trees?
    Just now the noise is uniform, it needs to be directional
     
  35. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    It won't look good I think.
    The current 3d noise effect looks good because it's "random" noise and because the noise intensity is usually not too high. If you make the noise pattern more obvious and with higher contrast, the cone shape of the beam will be too visible.
    What you are asking is basically the same than doing the cookie feature: having a "controlled" noise pattern with higher intensity. So it might be possible to have a similar effect with the cookie feature, but since I'm not 100% sure, I prefer not to give you false hopes! :)
     
  36. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Yes like a light cookie, Im also interested in that, how is that progressing?
     
  37. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Well it's a challenge... I am currently more focused on current performance improvement and on fixing stuff because of API changes in unity such as keeping support of HDRP, LWRP and VR. I am preparing a big update all about drawcall decrease btw, should be released next week.
    But once it will be fine, I will be able to focus more on this long awaited feature!
    Thanks :)
     
    Lars-Steenhoff likes this.
  38. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    I am extremely pleased to announce the release of Volumetric Light Beam 1.60.

    The main feature of this new update is GPU Instancing, a major optimization for high-end devices to draw hundreds of beams in 1 single drawcall. Learn more about this in the new Optimization page of the documentation.
    optim_gpu_instancing_batching.png

    You can now download a Windows PC and Mac OSX demo in addition to the Android and WebGL builds on this page.

    demo_screenshot.png

    Full changelog:
    Hope you'll like it!
     
    Last edited: Dec 11, 2018
  39. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi guys,

    Version 1.61 of the plugin has been released.
    It's mainly about improving compatibility with latest SRP updates (4.0.0 or higher). When using the previous 1.60 version, the beams could have some unwanted artifacts visible. This is now fixed, but it requires some minor configuration: everything is explained in the documentation here.

    Full changelog:
    Enjoy :)
     
  40. tork12

    tork12

    Joined:
    Dec 16, 2017
    Posts:
    42
    Hello, I just sent an e-mail regarding light beams becoming pink after importing a scene with light beams. Followed the solution to delete VLB folder entirely, and re-import. It worked. For some reason it didn't work in a new project, but it did fix the problem in the existing project. Just posting here to let you and others know.
     
    techsalad likes this.
  41. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks you very much for sharing this. I am glad you managed to fix your problem. Unity's asset import process is sometimes a bit buggy...
    Many thanks!
     
  42. FreeReignPublishing

    FreeReignPublishing

    Joined:
    Oct 22, 2017
    Posts:
    52
    Hi, is there a way to add more rays to the dynamic occlusion?
     
  43. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Currently it performs 4 raycasts, and this is not editable.
    Why would need more rays? Is it because some parts of your beam are intercepting with some geometry, but the rays don't catch it?
    Thanks
     
  44. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    211
    Hi, whenever I start up the game on iOS I get this error printed to the log.


    The referenced script (Unknown) on this Behaviour is missing!
    UnityEngine.Resources:LoadAll(String)
    VLB.Config:get_Instance()
    VLB.Noise3D:LoadIfNeeded()
    VLB.Noise3D:OnStartUp()

    The referenced script on this Behaviour (Game Object '<null>') is missing!
    UnityEngine.Resources:LoadAll(String)
    VLB.Config:get_Instance()
    VLB.Noise3D:LoadIfNeeded()
    VLB.Noise3D:OnStartUp()

    A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 64 bytes but expected 3552 bytes)
    Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
    UnityEngine.Resources:LoadAll(String)
    VLB.Config:get_Instance()

    VLB.Noise3D:LoadIfNeeded()
    VLB.Noise3D:OnStartUp()
     
  45. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,

    Thank you for notifying me this issue. I've never heard of it, but I will investigate. Would it be possible to provide me as many information as possible please:
    - Unity version
    - Windows or Mac?
    - iOS version and device model

    So you can export your project fine to iOS, but this issue is raised when you try to execute it on the device?
    Does it work if you run it in the editor, or on other platform (PC, Android)?

    Many thanks
    TS
     
  46. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    211
    This happens only on the ios device (iphone x, latest ios version), not when running it in the editor on mac or windows.
     
  47. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    211
    Errors like these can be related to other scripts though, I've seen it happen before - so there is a small chance that this is not related to the stack trace at all.

    But, with that being said: I see that the VLB code has a habit of mixing UnityEditor specific code inside the MonoBehaviours. This is a really bad practice and you should not do this. Create separate Editor classes for your editor code to get better code separation (and hopefully get rid of errors like the one I am seeing).

    Don't do this sort of thing in scripts:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using UnityEditor;
    3. #endif
    4.  
    I hope to see the asset updated :)
     
  48. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    So I tried to reproduce the issue with several Unity versions and on several iOS devices but I couldn't. Do you think it would be possible to share with me your project (or at least a subset of it)? If yes, please contact me via the support email: techsaladunity@gmail.com

    Regarding your comment, have you tried to remove the editor only code in Config.cs to try if it works?
    I doubt it would, because AFAIK it's not recommended to serialize properties only with UNITY_EDITOR enabled. But having editor only logic or functions is fine. I totally agree that all the editor code should not be mixed with MonoBehaviours classes, and in the plugin most of the editor code is in separate classes/files.
    But if you need a very specific behavior to be executed only in editor and not in standalone builds, I personally thinks it's more convenient and cleaner to have some scarce UNITY_EDITOR logic code in the MonoBehavior.

    If you want, I could try to make you a custom version without any UNITY_EDITOR code in MonoBehavior classes to validate if the issue comes from that or not.

    Anyway please let me know.
    Thanks
    TS
     
    LoneDev6 likes this.
  49. FeedMyData

    FeedMyData

    Joined:
    Oct 19, 2013
    Posts:
    4
    Quick note to say that on LWRP 4.9 you need to tick in the LightweightRenderPipelineAsset Depth Texture and... Opaque Texture as well.
    Otherwise the asset seems to work great! Well done.
     
    techsalad likes this.
  50. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi.
    Thank you very much for notifying this info. I will update the documentation about it.
    Thanks