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

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Thanks TechSalad.
    I do have several mixed lights, but I already had that optimization/workaround enabled.
    The fact that my SRP batches keep alternating between two different shaders (yours and URP lit), the latter suggestion makes sense!
    I'll check it out now :)
     
  2. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Yep, that worked its magic!
    Thanks buddy :)
     
    techsalad likes this.
  3. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Having now build the project for the Oculus Quest, I see the calls still aren't batched on that platform, but now with a different reason than before.
    upload_2021-7-25_14-20-41.png

    Does this ring a bell?
     
    Last edited: Jul 25, 2021
  4. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Nope, I'll try to repro on my side.
    Can you show me your VR settings please? I guess you are using the "Multiview" Stereo Rendering Mode?
    Screenshot_7.png
     
  5. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Great :)

    Yes, that's right

    upload_2021-7-25_14-33-57.png

    upload_2021-7-25_14-34-9.png
     
    techsalad likes this.
  6. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Have you managed to see in the Frame Debugger other regular objects batched by the SRP Batcher when running on your Quest? For some reasons the SRP Batcher seems to be completely disabled when running on the device on my side :(

    Btw are you using OpenGL or Vulkan on the Quest?
     
    Last edited: Jul 25, 2021
  7. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    I am currently using OpenGLES3.

    Some batching is occuring but not as much as I would like to see, and I'm not sure that SRP Batcher is involved or whether it's static batching at play.

    I've noticed that disabling all lighting in my scene and making the objects non-static causes the volumetric beams to batch properly, even on Oculus using SRP batcher.
    Do you see the same behaviour on your end?
     
    techsalad likes this.
  8. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Ok, and you are sure all of your lights are NOT affecting your beams ("culling mask" ignoring your beam's layer)?
    On my side SRP Batcher simply doesn't work with OpenGL on the device for some reasons. But it works fine with Vulkan. I am using the Quest 1 though.
     
  9. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Yes, very much so.
    upload_2021-7-25_16-39-36.png

    I'll try Vulkan then, perhaps it'll help.
     
  10. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Maybe if you can try to send me your Unity scene by PM (delete everything and keep the beams and the lights?), so I could try to test it on my side?
     
  11. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Switching to Vulkan seems to solve my issues :)
    I'll get back in touch if the issue pops back up.
    Thanks for your efforts in helping out!
     
    techsalad likes this.
  12. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks a lot for your quick feedback and all the info. Glad you found something that finally works :)
    TBH I don't know why it doesn't work with OpenGL, batching support is quite a mess to debug in Unity :(
    Yes do not hesitate to get back to me, I am here to help!
    If you wish, please consider writing a review on the store.
    Cheers!
    TS
     
  13. lucidtripper

    lucidtripper

    Joined:
    Aug 3, 2017
    Posts:
    24
    LOVE THIS ASSET.. VOLUMETRIC LIGHTS ARE SO SEXY

    FIXED: the light cone was not on "default" layer - so my 360 camera couldn't see it (has a setting to ignore stuff not on default layer)

    here's a pov in vr = works very well in 3d



    but not working in 360 render output...



    I tried putting your scripts "before" the 360 script in "SCRIPT EXECUTION ORDER" project settings

    360 works fine with post processing

    any suggestion how I can get it to work ?

    here's the script i use to render mono360

    Code (CSharp):
    1. {
    2.  
    3. using UnityEngine;
    4. using UnityEngine.Rendering;
    5.  
    6. public class Render360 : MonoBehaviour
    7.     Camera cam;
    8.  
    9.     public RenderTexture cubemapLeftEye;  // 4096x4096
    10.  
    11.     public RenderTexture cubemapEquirect;  // 4096x4096 stretched equirectangular very nice
    12.  
    13.     void LateUpdate()
    14.     {
    15.         Camera cam = GetComponent<Camera>();
    16.  
    17.         if (cam == null) { cam = GetComponentInParent<Camera>(); }
    18.         if (cam == null) { Debug.Log("stereo 360 capture node has no camera or parent camera"); }
    19.      
    20.         {
    21.             cam.stereoSeparation = 0;  // zero ipd for mono = centre eye
    22.             cam.RenderToCubemap(cubemapLeftEye, 63, Camera.MonoOrStereoscopicEye.Mono);
    23.             cubemapLeftEye.ConvertToEquirect(cubemapEquirect, Camera.MonoOrStereoscopicEye.Mono);
    24.  
    25.         }
    26.     }
    27. }
     
    Last edited: Sep 3, 2021
    techsalad likes this.
  14. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey!
    Thank you for your message and for reporting the issue. TBH I never tried 360 rendering and I am not familiar with it.
    I will try your script to see if I manage to reproduce the issue.
    Are you using the built-in render pipeline, URP or HDRP?
    And just curious, why are you using the 360 rendering? What's your use case?
    Cheers
    TS
     
    lucidtripper likes this.
  15. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Oh I didn't see your edit as "FIXED". Glad you figured it out!
    Cheers
    TS
     
  16. lucidtripper

    lucidtripper

    Joined:
    Aug 3, 2017
    Posts:
    24
    thanks, I managed to fix the issue - it was a layer thing.. I'm making a music video inside a vr environment - sending the 360 camera out direct to OBS for recording

     
    techsalad likes this.
  17. kodai100

    kodai100

    Joined:
    Sep 29, 2016
    Posts:
    5
    Hi there,
    First, thanks for this package. this asset has very high scalability and easy to use.

    I want to know just one thing, do you have any plan to add assembly definition files in the VLB package ?
    I think it would be more engineer friendly.

    Thanks.
     
  18. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey,
    Thank you for your message.
    About assembly definition files, I didn't included them in the package to make the plugin as simple as possible. In addition, I am not fully aware of potential issues it could cause with more exotic project configurations or platforms. On top of that, the full source code of the plugin is provided so a user can create the assembly definition files himself if needed.
    However, I agree that it could be an interesting addition for some users. I don't know what are the possibilities to make it optional though. I will investigate the available solutions.
    Anyway, thank you for the suggestion :)
    Cheers
    TS
     
    kodai100 likes this.
  19. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    395
    Hi,

    Sorry I'm not sure if this has been answered but I'm currently using a 'Background' camera to render a background silhoutte and I would like the lightbeams to show over the top of this silhouette. The silhouette is using a cut-out shader. Currently the lightbeams do not show - any advise on this?


    Left: Scene view shows beam over silhouette correctly
    Right: Game view beam is hidden by background layer

    Thanks! Jake
     
  20. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey Jake,
    In the plugin configuration, you can customize the render queue on which the beams are rendered. They are probably drawn after you cut-out geometry.
    First check the render queue used by your cutout shader (it's probably higher than 3000). Try to decrease it to 3000 if possible.
    If it's not possible, you can increase the render queue of the plugin, so it's higher than the one used by the cut-out shader: http://saladgamer.com/vlb-doc/config.html#render-queue
    Open the configuration of the plugin, and set a custom render queue here:
    Screenshot_1.png

    Please let me know if it works.
    Thanks :)
     
    stonstad likes this.
  21. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Is there a reason why the documentation website isn't working? (EDIT: For some reason it wasn't reachable using my internet provider, I had to use a VPN to access it :confused:)

    Also, I found a few problems related to using this in HDRP. It doesn't seem to work well with HDRP's Physical Light units.

    Day scene:
    upload_2022-1-11_17-14-26.png

    Night:
    upload_2022-1-11_17-14-57.png

    Is there a way to fix this?

    No matter what my camera's exposure is, the volumetric beams are always at same brightness level
     
    Last edited: Jan 11, 2022
  22. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello

    The documentation website is supposed to be accessible: http://saladgamer.com/vlb-doc/
    If you can access it only by using VPN, it's quite worrying... Could you please tell me in which country are you physically located please?

    Regarding your issue with HDRP, I am not sure to follow. What properties have you changed between the 2 screenshots? Only the main camera exposure?

    Thanks
    TS
     
  23. DrMeatball

    DrMeatball

    Joined:
    Nov 21, 2021
    Posts:
    109
    Just wanted to say TYVM!! Love this asset!

    vol1.png
     
    DragonCoder and techsalad like this.
  24. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks a lot for sharing :)
     
  25. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    hi @techsalad, VLB is working fine in a project using URP. But problem is that when I load a light that has vlb component attached via assets bundle. Its show script has compilation error and light beam not showing. How to resolve this error. Thanks.
    Capture.PNG
     

    Attached Files:

  26. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey,
    Sorry for the issue you have. Do you think it might be possible to send me a version of you project by PM please? Honestly the reason of errors like that can be a lot of different things, so it might be more efficient if I could have a look directly.
    Thanks
     
  27. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    So I tried on my side. I already have some tests about the asset bundles in my test suite, and I created a new project from scratch to load light and beams prefabs from bundles, both synchronous and asynchronous, but I couldn't reproduce your issue.

    What happens if you try to simply drag and drop the prefab containing the light and beam (the one that ends up in the bundle) directly in your scene? Does it work fine?

    Thanks!
     
  28. Futurristic

    Futurristic

    Joined:
    Jun 21, 2016
    Posts:
    47
    Hi, Thanks for your quick reply. If I try to simply drag and drop the prefab containing the light and beam, It's working fine. There is no error and it all is good. My scenario is that - I am using 2 projects. One for making an assets bundle(containing vlb light beam) and uploading that asset bundle on the server. And other projects for downloading assets bundle from the server and the problem occurs. I am doing all required URP settings in both projects for VLB. Both unity versions(for making and downloading assets bundle) are the same 2019.4.33f1. Thanks!
     
  29. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks for the clarification about your use-case.

    I am not familiar about how loading asset bundles between 2 different projects is supported in Unity. Just curious: why do you have this scenario, instead of having 1 project to handle both? Because when developing and testing, it sounds faster and more convenient to have your prefabs directly available in your "game projects", instead of going through the asset bundles loading all the time?

    Have you tried to copy your prefab from your "asset bundles builder project" to your "game project" to see if it works?

    It really looks like your issue is a GUID mismatch on your VLB script assets between your 2 projects. It's not supposed to happen, since the GUID of assets of a plugin are downloaded from the package manager and all users are supposed to have the same. But maybe you deleted them by mistake?
    Could you please check them? For example, check the file VolumetricLightBeam.cs.meta located in the folder Assets\Plugins\VolumetricLightBeam\Scripts in your "asset bundles builder project" and compare it to the exact same file in your "game project" please.

    Thanks
     
  30. Slaktus

    Slaktus

    Joined:
    Dec 5, 2012
    Posts:
    60
    Hey, just about to buy this for a mobile project, and got a few questions: Does the shader use fresnel for the edge attenuation, and is at all possible to use my own mesh instead of the supplied cone?

    I would prefer to use a rectangular mesh rather than a cone, and I'm happy to make my own mesh for the purpose. Are there any special considerations I need to take into account such as normal directions, face orientation or other details?

    Thanks in advance, the asset looks great!
     
  31. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey!

    Thanks for your interest.

    No it's not possible to provide your own mesh. However, it's possible to have squared beams by using a custom mesh with 4 sides: In your beam, switch the Mesh Type property to Custom and then adjust the sides count property to 4.

    However, I have to admit that it's not ideal : for example to have rectangle beams, you'll have to play with the scaling. The plugin has been designed to handle cone light beams in priority.

    Cheers!
     
    Last edited: Feb 7, 2022
    Slaktus likes this.
  32. Slaktus

    Slaktus

    Joined:
    Dec 5, 2012
    Posts:
    60
    Excellent, bought it a few minutes ago and it looks great so far. Just built the demo scene for Android and it seems to be all I hoped for.

    Thanks for the quick response too, very reassuring. Great work!
     
    techsalad likes this.
  33. leandic

    leandic

    Joined:
    Sep 3, 2014
    Posts:
    7
    Bug report

    I'm using VLB on a VR project for the Oculus Quest 2, and have run into the issue of Multiview and rendering artefacts in the right eye (like a shadow of opaque geometry). The issue is described in Known Issues[1] and setting "Opaque geometry" to 0 fixes the issue. But for future reference, this is not fixed (or broken again) in newer versions of Unity.

    I am using 2020.3.26f1 and the built-in render pipeline.
    I am in no rush to have it fixed, as the workaround is satisfactory, but wanted to report it anyway.

    *[1] "Shadow" artifacts in one eye on mobile Single Pass VR (e.g. Oculus Quest)
     
  34. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks a lot for your report!

    Just to be sure, you are using the Single Pass Instanced "Stereo Rendering Mode" right?
    Screenshot_1.png

    Indeed this issue is supposed to be fixed in this Unity version. I'll investigate.
    Thanks
     
  35. leandic

    leandic

    Joined:
    Sep 3, 2014
    Posts:
    7
    I'm using Multiview on Oculus, which should be very similar to Single Pass Instanced, just for OpenGL AFAIK

    multiview.png
     
    techsalad likes this.
  36. stonstad

    stonstad

    Joined:
    Jan 19, 2018
    Posts:
    660
    I just wanted to drop in and say this is a great product. Thank you for creating it!
     
    techsalad likes this.
  37. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks a lot for your feedback :)
     
  38. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi @mortenb, thanks for the clarification.
    I have a potential fix for you. It seems I cannot send you a PM on the forum. Could you please send me an email (techsaladunity at gmail dot com) so I could give you access to it?
    Thanks!
     
  39. OmarGC

    OmarGC

    Joined:
    Apr 18, 2021
    Posts:
    11
    Hello @techsalad

    I have a few questions
    1. What is the difference between having the VLB component on its own or attached to a Unity light?
    2. Any pointers on using the asset for natural light?
    3. Is there anything I should look our for when using the SRP Batcher option? I'm using URP for PC and mobile. According to VLB's optimization guidelines I should be good to use the SRP Batcher. The guidelines have details about the limitations of GPU Instancing but not much about SRP Batcher.
     
    Last edited: Apr 6, 2022
  40. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello,

    With the VLB component only, you will have only the volumetric effect of the beam. But the geometry located in front of the beam won’t be lit.

    With the VLB component attached to a unity light, the unity light will lit the geometry while the VLB component will render the volumetric effect. In addition, some common properties will be bound together.

    This asset is designed to simulate local volumetric spotlights. It’s not suited to render volumetric fog in large environment nor to simulate sunlight.

    Regarding optimization guidelines with SRP Batcher, I have to admit the documentation is not clear enough. Let me have a look at my test suite, update the documentation accordingly and I’ll keep you posted very soon.

    thanks!
     
    OmarGC likes this.
  41. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,700
    Out of curiosity.. What is the issue with creating a simple circular (or ring-shaped) mesh instead of a cone and support volumetric point-lights that way?
     
  42. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    The current shader I made to render the volumetric beam of light requires the geometry to be a cone, and uses some geometry properties like the cone angle and apex position to properly simulate the propagation of light in the shape.
    In short: the current technique I use in very fast, but not flexible enough to support other shapes or more advanced features like volumetric shadows.
    However, the next plugin update will introduce a new implementation (in addition to the current one). The new implementation will be a bit more costly but will support shadows, cookies, and will be more flexible about other shapes support.
     
    Last edited: Apr 8, 2022
  43. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi again @OmarGC

    I updated the documentation to make it more clear about limitation of drawcall batching.

    Basically, the limitations of GPU Instancing and SRP Batcher are the same. Some properties of the light beams require to use a different shader variant, and 2 beams using different shader variants can't be batched together: https://saladgamer.com/vlb-doc/optimization/#what-can-be-batched

    You can simply select 2 beams in Unity: the info panel at the bottom of the inspector window will explain you the reason in case the 2 selected beams can't be batched together: https://saladgamer.com/vlb-doc/optimization/#debugging

    I hope it helps
    Thanks.
     
    OmarGC likes this.
  44. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    I'm interested in finding a solution for volumetric lighting in a first-person game for the Nintendo Switch. How does this stack up against other solutions in terms of performance?
     
  45. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey, thanks for your interest.

    I can't really give you a clear comparison performance-wise of Volumetric Light Beam against other volumetric lighting plugins because I haven't tried them all nor profiled their performance in depth.

    What can I say, is that the Volumetric Light Beam plugin aims to deliver a volumetric lighting solution for low-end devices (mobile...), for which traditionally volumetric lighting techniques are usually too expensive.
    That's why some developers have used it to ship games on Oculus Quest or even Oculus Go.

    The counterpart is that it's probably more limited than some other plugins. For example it only supports spotlights, and currently doesn't support volumetric shadows (which will be supported in a next update though, but will require a bit more performance obviously).

    Regarding the Nintendo Switch, the plugin doesn't officially support this platform since I am not a certified Nintendo developer and have no Switch devkit. However the plugin has already been used to ship games on it, like Hexagroove:
    hexagroove1.jpg

    I hope it helps
    Thanks
     
  46. Wikzo-DK

    Wikzo-DK

    Joined:
    Sep 6, 2012
    Posts:
    83
    Thanks for the quick response. I just tried the demo on Android and PC. It looks good. However, I noticed that the light beams don't seem to be completely occluded by the pillars in the scene? (raycasting and depth buffer). I took the following screenshots with the "Rotation" slider set to 0. Not sure if that has something to do with update rate mentioned in http://saladgamer.com/vlb-doc/comp-dynocclusion-raycasting/?



     
  47. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    The "depth buffer" occlusion mode does occlude the beam. More info about the different occlusion mode here.

    Here how it looks from a top view.
    Screenshot_1.png

    TS
     
  48. TsvetelinaStoyanova

    TsvetelinaStoyanova

    Joined:
    Oct 16, 2020
    Posts:
    8
    Hi, my company bought your asset and it's really great, but I could use a little help for my specific case.
    The lights with "VolumetricLightBeam" don't show when they're children to a parent with a small scale, like "0.001".

    upload_2022-6-15_11-32-51.png

    I'm working on a 3D viewer for the architect industry and we have the restriction of our root node to be with this scale - this comes from the file format and cannot be avoided.
    The issue seems like a loss of precision, maybe you can help me to customize some of your shaders so it works with larger precision?
    Thanks in advance and greetings for your amazing work on the asset.
     
  49. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello,

    Thanks a lot for your message, I am glad you like the asset :)

    I can already think of a couple of lines of code in the shaders that won't work as expect with very very small scaling like that. So yes the problem is probably caused by hardcoded shader values.
    Please give me a couple of days to reproduce the issue and fix it.

    Thank you
    TS
     
    TsvetelinaStoyanova likes this.
  50. simonkingandaoking

    simonkingandaoking

    Joined:
    Dec 27, 2021
    Posts:
    20
    i bought this plugn thinking it that i can use a volumetric light similar to the one in hdrp,because i wanted to simulate sunlight,however it doesnt seem to work that way,the shadows are very strange
     

    Attached Files: