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

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Good news, this issue has been fixed in latest 1.85 update: http://saladgamer.com/vlb-doc/changelog/
    While the Built-In Render Pipeline, URP and HDRP support is more stable than ever, maintaining support of the obsolete LWRP was more and more complicated, so I had to drop it.
    I am pretty sure you won't be affected by this since Unity moved from LWRP to URP months ago (from Unity 2019.3.0). But in case it's a problem for you and you can't upgrade your Unity version to a more recent one with URP, please get it touch with me.
    Thanks
     
    DrOcto likes this.
  2. pdinklag

    pdinklag

    Joined:
    Jan 24, 2017
    Posts:
    154
    First off, thanks for this asset! :)

    I get this shader compilation error message in URP (8.2.0 in Unity 2019.1.2) in the 1.85 update:

    Shader error in 'Hidden/VolumetricLightBeamSRP': undeclared identifier '_ScaledScreenParams' at Assets/Plugins/VolumetricLightBeam/Resources/Shaders/ShaderSpecificURP.cginc(43) (on d3d11)
    In the git diff of 1.85 compared against 1.84 the definition was clearly removed
    Code (CSharp):
    1. CBUFFER_START(_PerCamera)
    2. float4 _ScaledScreenParams; // only used by LWRP for render scale
    3. CBUFFER_END
    Apparently something was forgotten? Everything seems to be working fine despite the error message, just wanted to report that.
     
  3. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Thank you for your message,
    How are you using URP with 2019.1.2 ? I thought URP was introduced with 2019.3.0.
    Are you sure you are not using LWRP ?
    Thanks

    EDIT:
    when creating a new project with 2019.2.0, it only offers me LWRP (and not URP)
    Screenshot_1.png
     
    Last edited: Sep 8, 2020
  4. pdinklag

    pdinklag

    Joined:
    Jan 24, 2017
    Posts:
    154
    Argh, I am in Unity 2020.1.2. :confused: Sorry for the confusion.
    But yes, I am very sure I am using URP version 8.2.0, that's what the package manager reports.

    In any event, in VLB version 1.85, you removed that ScaledScreenParams variable declaration that is still being used literally a few lines below (in VLBSampleDepthTexture).
     
    techsalad likes this.
  5. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Ok thanks for the clarification.
    Yes I know that ScaledScreenParams is still used, but it's supposed to be declared in the URP package, that's why I removed it. I will investigate using the exact same version as you.
    I'll let you know.
    Thanks.
     
  6. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    So I tried many things, with Unity 2020.1.1, 2020.1.2, 2020.1.3, with all the Rendering Modes, but I don't manage to reproduce the issue. Here is a screenshot:
    Screenshot_20.png

    Could you please provide me a screenshot of your plugin configuration?
    Are you running on Windows or Mac?
    Thanks
     
  7. pdinklag

    pdinklag

    Joined:
    Jan 24, 2017
    Posts:
    154
    OK, for whatever reason, the render pipeline in my VLB config override was set to Built-In. Setting that to URP gets rid of the compilation error as one would expect. I know I had it set to URP before at some point, but I created a new configuration after an update. Is Built-In maybe the default selection that I overlooked? If not, who knows what I was thinking (if anything) when changing it.

    Thank you for clearing it up!
     
  8. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Thanks for the feedback. I am glad it works fine :)
    This property is supposed to be automatically set to the proper value depending on the detected render pipeline. But you are not the only one to warn me that it didn't work. I'll investigate...
    Thank you.
     
  9. kye3d

    kye3d

    Joined:
    Mar 16, 2020
    Posts:
    1
    I know it states it in the product description but i just want to make sure, this can't be used with VRC SDK? theres no way to bake the geometry/shader into the scene?
     
  10. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    No sorry it's definitely not possible. The plugin relies to much on scripts to send data to the shader at start-up and during runtime.
     
  11. zagreekie

    zagreekie

    Joined:
    Nov 20, 2017
    Posts:
    29
    So far loving the asset, but i had a question in regards to the dust particles, currently, we can select the direction of "random" or "beam" would it be possible to add an option for world coordinates? I .e.make the particles flow on the X-axis, positive speed = going one-way negative speed going the other way?
     
  12. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thank you very much for your message, I am glad you love the asset :)
    Thanks for suggestion, I think it's doable, I'll investigate to implement it and I'll let you know.
    Cheers!
     
  13. zagreekie

    zagreekie

    Joined:
    Nov 20, 2017
    Posts:
    29
    That would be outstanding if possible! I just noticed you do something very similar with 3d noise direction, although I would assume it's far simpler with a noise texture than particles.
     
    techsalad likes this.
  14. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    I have developed the feature, I will send it to you by PM.
     
  15. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    AthrunVLokiz and Lars-Steenhoff like this.
  16. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Very nice update! Thanks
     
    techsalad likes this.
  17. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,701
    This a really awesome asset! Especially the performance is great.

    Though I have one usecase help would be greatly appreciated for.
    Am trying to use this in a 2.5D design. That means the 3D terrain is "cut" in half and the camera is in a fixed position perpendicular to the cutting plane.

    The issue now is that with Depth Buffer occlusion, the light bleeds into the foreground across the cut plane (the mossy stone) like you can see here:
    Occlusion.png
    I'd like to prevent light from ending up there.
    Is there a way to enforce that the depth buffer of my foreground mesh (it is a separate mesh from the rest of the terrain) is set in such a way the volumetric light occlusion sees it as a solid wall all the way to the camera plane and thus stops the light beam?

    Or maybe alternatively have the mesh be drawn always ontop of the light?

    Huge thanks in advance!
     
  18. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Thank you for your message, I am glad you like it!
    I am not sure to exactly understand the problem, and sorry but I don't really get what's on the screenshot :)
    Would you like the Depth Buffer occlusion to work in 2D instead of in 3D? Maybe could you provide me a video showing the problem in more details please, so I could give you more relevant suggestions? You can PM me or contact me on techsaladunity@gmail.com if you prefer :)
    Thanks!
     
  19. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Hi,

    I'm using URP with 2019.4.15f1. Whenever I use volumetric light beam with the Dynamic Occlusion Depth Buffer enabled, I get a
    error once per frame while looking at the light beam. My scene is lightmapped and my pipeline renderer has "Depth Texture enabled"—the error also doesn't seem to be causing any problems with functionality. Do you have any idea what this might be?
     
  20. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Sorry for the error you are having. Is there any callstack available in the console when this error message is outputed?
    Meanwhile I'll check on my side.
    Thanks

    EDIT:
    I have tested on my side with a similar setup (Unity 2019.4.15, URP 7.3.1, a beam with Depth Occlusion Depth Buffer component), but I don't manage to reproduce the issue.
    Screenshot_1.png
    The Depth Occlusion Depth Buffer component creates a RT with a 16 bits depth buffer, so I don't think it can cause this error message.
    If possible, please share with me by email or PM your project so I can have a look on my side.
     
    Last edited: Dec 4, 2020
  21. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Thanks for the quick reply! Here's the callstack:
    Capture.PNG
    I'm sure it's some bizarre setting or conflict I have on somewhere—I'm pretty sure I wasn't getting it a week ago, it seems to be a new development in the past few days.

    Unfortunately I'm not available to send my project to you for the next few days, but once my workload clears up a bit I should be able to help debug this more, if one of us still hasn't figured out what it is by then.

    Also forgot to mention that it happens in Scene view and Play mode whenever the Scene camera or active game camera is pointing at the VLP lightbeam—no logging when pointing elsewhere.

    Thanks again! Really love the tool otherwise, very easy to use and looks great.
     
  22. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Thanks for the details.
    The error comes from the plugin code, so I did some investigation, but I couldn't find what could cause this issue.
    The RenderTexture is properly created with a 16 bit depth buffer, so I don't get why this error is reported.
    According to the URP API, the UniversalAdditionalCameraData.cameraOutput property has to be setup to create a Depth RT (in addition to the regular camera) with URP. But in fact the documentation is not up-to-date at all and this extra property has been deprecated months ago...
    So if you can send me some files related to your project someday, I would be interested.
    I hope this issue doesn't prevent you from working and enjoying the plugin.
    Cheers
    TS
     
  23. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Hi,

    Sorry that I still haven't had time to send the project! However, I think I've found the culprit: I'm using SC's Post Effects (https://assetstore.unity.com/packag...en-camera-effects/sc-post-effects-pack-108753) in the same project, and using the Blur effect from that package. Enabling this requires putting a Blur Renderer component on my URP Renderer object. When the Blur component is present, I get the RenderTexture warning logging—when it's gone, no warnings.

    I don't really know anything about graphics programming, so this is a little out of my weight class, but I noticed that SC's Blur Renderer was calling CommandBuffer.GetTemporaryRT with a value of 0 for the depthBuffer—changing that to 16 stopped the warnings again.

    Not really sure what any of this means, and it seems like it might ultimately be more of an SCPE thing, but I hope it's helpful! Thanks again for a great tool.
     
    techsalad likes this.
  24. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thank you for the feedback. I am glad you managed to figure it out.
    I'll investigate if there is anything I can do to improve and maximize the compatibility.
    Thanks
    TS
     
  25. adrian-taylor09

    adrian-taylor09

    Joined:
    Dec 22, 2016
    Posts:
    63
    Hi there, I'm trying to achieve an effect similar to what you've shown in this post... would you mind explaining how you achieved this?
     
  26. Personuo

    Personuo

    Joined:
    Mar 19, 2014
    Posts:
    129
    I manually add each beam of light, in fact, after a long period of research, I found that in addition to raymatch, it is difficult to make a good-looking volume of light, but because I do hand games, so it is impossible to use raymatch that performance is too poor
     
  27. jsunandmax

    jsunandmax

    Joined:
    Jan 12, 2013
    Posts:
    17
    so, does this thing work well in URP for 2020.2.0f1 ???
     
  28. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello.
    Yes the plugin works perfectly fine with URP and Unity 2020.2.0.
    Do you encounter any issues?
    Please follow this very quick guide and video to learn how to setup the plugin with URP.
    Thanks
     
  29. purejenix

    purejenix

    Joined:
    Jun 15, 2017
    Posts:
    3
    Hi,
    Is it possible to set distinct configuration file for each platform (desktop, android, ios) as we need to vary some parameters depending on platform (like Soft Intersections)?
     
  30. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    No it's currently not possible to do that. However I think it's a very relevant suggestion.
    I already thought it would be useful to create specific Configuration asset for a platform, mainly to tweak the Rendering Mode. With this, you would also be able to enable/disable certain features per platform like the Soft Intersect with Opaque Geometry.
    Would it be useful for you? Or would you need to tweak other features which are not accessible through the Config asset?
    Thanks
     
  31. purejenix

    purejenix

    Joined:
    Jun 15, 2017
    Posts:
    3
    It will be useful and enough for us to have configuration asset per platform. I will be very grateful If you could implement this feature. Thank you :)
     
    techsalad likes this.
  32. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks for the feedback. I'll investigate to implement it and I'll contact you as soon as I'll have something working.
    Cheers
     
  33. robinkuijs

    robinkuijs

    Joined:
    Dec 29, 2020
    Posts:
    4
    I'm having an issue with the volumetric lights in VR. It seems like there is some shadow problem.

    I have recorded this video:
    . At 0:13 I'm switching on the volumetric light and and switched it off at around 0:20. Could oyu please help me solve this?
     
    Last edited: Mar 3, 2021
  34. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hi,
    Sorry for your issue. Sure I'll do my best to help you.
    Could you please provide me the following info:
    - Unity version
    - VLB plugin version
    - Render Pipeline (Builtin, URP, HDRP)
    - Which VR Stereo rendering mode are you using (visible in the XR settings)?
    Screenshot_1.png
    - Does the issue happen when running in the editor?
    - Which is your target headset/platforn? Does the issue happen when running on your target platform from a exported build?

    Thanks
     
  35. robinkuijs

    robinkuijs

    Joined:
    Dec 29, 2020
    Posts:
    4
    Thank you for the quick reply!
    My Unity version is 2019.4.19f1 with built-in RP. VLB version is 1.92. Stereo Rendering Mode is set to Multipass. I observed this in play mode using Oculus Link with Quest 2. I will try to build the scene, I haven’t tried that yet.

     
  36. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks for the info! That's weird, you should not have any issue for this setup. Using the Oculus cable, it should behave like any regular VR Headset.

    Btw, are you using the old (and deprecated) VR settings (through Player settings)?
    Screenshot_21.png

    Or the new one (through XR Plugin Management)?
    Screenshot_23.png

    Can you please also take a screenshot of your XR/VR settings so I can see exactly which VR plugin and settings you are using?

    Thanks!
     
  37. robinkuijs

    robinkuijs

    Joined:
    Dec 29, 2020
    Posts:
    4
    Trying to build the file now, it takes a while.
    These are my settings in the attachment. I think these are the new settings right?

    Edit: I built the file and it's the same when I run it straight from the Quest 2.
     

    Attached Files:

  38. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks!
    Yes these are the new settings.
    I don't know what's going on, I will run some tests on my side.
    In the meantime, have you tried to change the VR stereo rendering mode to single pass to see if it works better?
    Last question, can you please take a screenshot of the plugin config so I could try with the exact same settings than you?
    Thank you again!
     
  39. robinkuijs

    robinkuijs

    Joined:
    Dec 29, 2020
    Posts:
    4
    Thanks for the reply again!
    I changed my XR plugin settings to single pass and this solved the issue. I also changed the settings to single pass in the plugin settings as you can see in the screenshot. I would however prefer to use multi pass. But please take your time, I am not in a hurry to solve this :)
     

    Attached Files:

    Last edited: Mar 3, 2021
    techsalad likes this.
  40. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Glad this workaround works!
    I'll investigate the issue anyway, it should work fine with multipass stereo rendering mode.
     
  41. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Hello, when grabbing the latest version I ran into two errors.

    Assets\Plugins\VolumetricLightBeam\Scripts\DynamicOcclusion.cs(9,21): error CS0117: 'Consts' does not contain a definition for 'HelpUrlDynamicOcclusion'

    Assets\Plugins\VolumetricLightBeam\Scripts\DynamicOcclusion.cs(15,16): error CS0246: The type or namespace name 'OccluderDimensions' could not be found (are you missing a using directive or an assembly reference?)

    I'm on default render pipeline, Unity 2020.1.11. Just a side note that I'm using "Shader Control" in my build to trim out any unused shader keywords, though I'm not altering any of the Volumetric light beam shaders.
     
  42. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello,
    This is a common problem with the package manager which doesn't properly update plugin package and doesn't delete removed files. Please follow these steps to properly update it: http://saladgamer.com/vlb-doc/troubleshooting/#errors-after-updating-the-plugin
    Please let me know if it fixes your issue.
    Thanks
    TS
     
  43. Dobalina

    Dobalina

    Joined:
    Sep 6, 2013
    Posts:
    105
    Oops, I should have known to check the online manual. Thanks! All is good now.
     
    techsalad likes this.
  44. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    SRP Batcher is refusing to batch my various beams, even though they are using a shared mesh. The frame debugger mentions "Node use different shader keywords". I'm using URP with SRP Batcher on Unity 2020.3.14f.
    Any thoughts on what I might be missing here?

    upload_2021-7-24_23-22-29.png
     
  45. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hello!
    There are multiple why 2 objects can be ignored by the SRP Batcher.

    Here is the documentation about beams batching: http://saladgamer.com/vlb-doc/optimization.html

    Do you have your "Rendering Mode" property set at "SRP Batcher" in the plugin config? http://saladgamer.com/vlb-doc/config.html#rendering-mode
    optim_rendering_mode_srp_batcher.png

    What's written in the beam's inspector info panel when you select 2 beams that are not batched together? The inspector will tell you the reason if the selected beams cannot be batched together. If nothing is written, it means batching is possible: http://saladgamer.com/vlb-doc/optimization.html#debugging
    optim_gpu_instancing_debugging.png

    Thank you!
    TS
     
    Last edited: Jul 25, 2021
  46. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Thanks for the fast reply TechSalad!

    No warning is displayed in the inspector when I select two volumetric beams during play mode.

    upload_2021-7-25_11-52-24.png

    I have SRP Batcher selected as Rendering Mode.
    upload_2021-7-25_11-53-19.png

    SRP Batcher is also enabled in the URP settings.
    upload_2021-7-25_11-55-5.png

    (continued...)
     

    Attached Files:

  47. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    Yet the Frame Debugger shows lots of DrawTransparentObjects
    upload_2021-7-25_11-57-11.png

    These SRP Batches are the following two that keep repeating (alternating).
    First this one:
    upload_2021-7-25_11-59-11.png
    Then this one:
    upload_2021-7-25_11-59-30.png

    (And then the first one again, and then the second one again, and so on.)
     

    Attached Files:

  48. DeMexi

    DeMexi

    Joined:
    Dec 5, 2017
    Posts:
    18
    For each of my volumetric lights I see the following seperate SRP batch:
    upload_2021-7-25_12-3-11.png

    It says "Node use different shader keywords".
    Does this ring any bell for you?

    (I'm on the latest version of the Volumetric Light Beam asset, by the way.)
     
  49. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Thanks for all the details.
    Unfortunately the SRP Batcher support in the Editor is pretty bad, and the error message "Node use different shader keywords" can cover pretty much all the cases that break the batching.

    But I think I know what's going on. I guess you have a "realtime" directional light in your scene? Unity carries a limitation when trying to batch transparent objects with realtime lighting, and it's a shame. Fortunately there is a workaround. Everything is explained in the documentation here: http://saladgamer.com/vlb-doc/optimization.html#real-time-lighting (it's wrongly written under the "GPU Instancing" category but it does happen also with SRP Batcher too, I'll make it clearer ASAP).
    Could you please try to use the mentioned workaround and check if it solves the issue?
    Thanks :)
     
  50. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    381
    Hey @DeMexi, me again :)

    I can think of another reason Unity would refuse to batch your beams.
    Let say you have a scene like that: a transparent (the red cube) drawn next to each Volumetric Light Beam.
    Screenshot_1.png

    In this case, the batching will depend on Unity choice. Sometimes it can work (rendering both red cubes and then both beams), but sometimes Unity can decide to render 1 cube, 1 beam, 1 cube and then 1 beam, preventing the beams (and the cubes) from being batched together.
    Screenshot_3.png


    The only way I know to take control of the rendering order is to put the cubes and the beams on different render queues. By default the beams are drawn on the "Transparent" (3000), like regular transparent objects. The plugin lets you customize that easily. In the plugin's config you can change that and try to render the beams on a different custom render queue like 3001.
    Screenshot_4.png

    With this trick, Unity will be forced to first draw the cubes on the Transparent queue (3000) and then the beams (queue 3001).
    Screenshot_5.png

    I hope it helps!
    Cheers
    TS