Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

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:
    164
    Hi @Prefab,
    So I did some experimentation to achieve a "black light" effect and I am pretty happy with the result. Have a look:
    vlb_blacklight.png

    What do you think? Is the kind of effect you would need?
    Thanks :)
     
    wetcircuit and Prefab like this.
  2. Prefab

    Prefab

    Joined:
    May 14, 2013
    Posts:
    42
    Hi @techsalad , that looks really great! I am purchasing this now thank you.
    I am wondering though how opaque can the cone be made so that a character can potentially hide in it. Also, probably similar question but can the circle on the floor created by the cone be made more obvious so that the player knows if they stand in the dark circle they are considered hidden.
     
  3. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Glad you like it :)
    Please send me an email to techsaladunity@gmail.com so I can send you the WIP version with this new feature.
    Regarding the beam transparency, yes you can control it to make it more opaque.
    Regarding the second question, the beam do not really create any "circle" on the floor. You can control how the beam fades when it's near some opaque geometry to make the transition sharper though. But if you really want to have some circle appearing on the floor, I would recommend you to use a projector to do that (like to do fake shadows).
     
  4. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    842
    :oops: (wondering what I could use this for….)
     
  5. Prefab

    Prefab

    Joined:
    May 14, 2013
    Posts:
    42
    I meant the circle like in the following screenshot, but I'm not sure if this can be done with the dark light feature:
    4220c30e-778e-43fa-bf6b-14c952258670_scaled.jpg

    Email sent :)
     
  6. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    In this screenshot, the yellow circle is due to the spotlight itself. So it won't work if you set a black unity light. But an alternative would be to use a projector with a cookie texture.
     
  7. thisnamesucks

    thisnamesucks

    Joined:
    Jan 11, 2013
    Posts:
    36
    I cant seem to get light beams to show up in scene view. I've tried importing it into a fresh project in both unity 2017 and 2018 but they wont show up. Everything works fine in play more though.
     
  8. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi,
    That's weird! Sorry for the inconvenience.
    On which OS are you running the Editor? Windows 10?
    Can you see the beam icon in the scene view?
    2018-06-28 09_17_03-Window.png
    When not running the game, you cannot see the beams in the scene view. But are they visible in the Game window?
    Could you check in the Editor option that you don't have any Graphic Emulation enabled please?

    2018-06-28 09_14_26-Window.png

    Please let me know,
    Thanks
     
  9. thisnamesucks

    thisnamesucks

    Joined:
    Jan 11, 2013
    Posts:
    36
    Im running on windows 10. I can see the icon in scene view and i already made sure that graphics emulation was disabled so im stumped as to what it could be. And I can see them in game view even when not in play mode.
     
    Last edited: Jun 28, 2018
  10. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Ok, very weird. But we'll find what's going on! Could you have a look at the following points please:
    - By default, the beams are created on the 'TransparentFX'. Please make sure this layer is not hidden in the editor:
    Screenshot_12.png

    - In the Editor hierarchy, when not playing, do you see a GameObject called "Beam Geometry" under the beam GameObject?
    Screenshot_11.png

    - If it still doesn't work, could you try to press the "Regenerate geometry" button.
    Screenshot_13.png

    Thanks
     
  11. thisnamesucks

    thisnamesucks

    Joined:
    Jan 11, 2013
    Posts:
    36
    It was transparentfx. Thanks for the help.
     
    techsalad likes this.
  12. IP_Animation_01

    IP_Animation_01

    Joined:
    Jul 28, 2016
    Posts:
    7
    Hey there,

    Picked up your plugin today, it's really nice! You mentioned that part of your WIP build is the functionality for different shaped geometry and/or cookies on spotlights - is there any prospect of this being made available? We really want to use this in our project, but the timeframe is very restricted so if it's likely to be available soon that would be amazing!
     
  13. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi there!
    thank you very much for your purchase, and I am glad you like it. Regarding these new features, yes I plan to release them. However they require a lot more work than I expected at first, and I am also working in priority on feature requests. For example the next update will be entirely focused on massive performance improvement and optimization.
    Regarding the WIP version, it's very far from being optimized: on which platform do you plan to run your project?
    Thanks
     
  14. IP_Animation_01

    IP_Animation_01

    Joined:
    Jul 28, 2016
    Posts:
    7
    Hey, cheers for getting back to me!

    We're offline rendering our project through AVPro for playback on Youtube/Vimeo, so won't be needing good performance in realtime.
     
  15. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Ok great! So I should be able to provide you with a WIP version including these features next week. Please send me an email at techsaladunity@gmail.com
    Thanks.
     
  16. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    45
    Hi there, got your asset earlier this week and it's fantastic! Just what I needed!

    I do have a question (which may sound basic) but is it possible to add a collider to the light beam so entities in a scene can be triggered if the beam passes over them?

    Or would you recommend an alternative solution?
     
    Last edited: Jul 6, 2018
  17. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!
    That's a very good question. So basically you would like to have access to callbacks like OnTriggerEnter?
    So it's currently not possible to do that because the shape of the cone mesh is transformed by the vertex shader.
    But it shouldn't be complicated to generate a proper lowpoly cone mesh on the CPU and attach a MeshCollider component. I can investigate this feature and I'll let you know.
    Thanks!
     
    Last edited: Jul 7, 2018
  18. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    45
    Haha, not really sure I understood any of that answer! :D But thanks for investigating - look forward to hearing your results!
     
  19. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi,
    I did some experimentation and I have a working WIP version :)
    So basically I added a new component "MeshColliderFiller". When attached to a VolumetricLightBeam, it will generate a lowpoly mesh collider or trigger at runtime. This way you can make it interact with any RigidBody, listen to the OnTriggerEnter/Exit callbacks...
    If you are interested, I can send you this WIP version asap, so you could tell me if it fits with your needs. Please send me an email at techsaladunity@gmail.com
    Thanks!
     
    tntfoz likes this.
  20. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    45
    Email sent! Thanks for your help. :)
     
  21. techsalad

    techsalad

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

    The Update 1.42 has been released on the AssetStore.
    It brings the new Trigger Zone feature, designed to track objects passing through the light beam and to track when the beam is passing over them. Just drop the new TriggerZone component on your beam to notify your RigidBodies when a beam lights them. It also works with Dynamic Occlusion enabled.
    triggerzone_demo.gif
    (The sphere turns green when passing through the beam)

    Hope you'll find the feature useful!
    Don't forget to write a short review the store if you like the asset :)

    And thank you @tntfoz for the suggestion and for your feedback during the development!
    Thanks!
     
    VIC20, f1chris, wetcircuit and 2 others like this.
  22. renardmf

    renardmf

    Joined:
    Jun 29, 2012
    Posts:
    45
    Hello,

    Were there any plans to support the lightweight render pipeline with this asset?

    Thanks for your help!
     
  23. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!
    Thanks for your interest .Yes it's definitely planned, I am working on it.
    If any of you are interested in testing the LWRP and HDRP support, send me an email at techsaladunity@gmail.com with your invoice ID and I will send you a custom version asap.
    Thanks
     
  24. DeadNinja

    DeadNinja

    Joined:
    Jun 3, 2013
    Posts:
    32
    Hi, could you please tell what the status of rectangular beam/custom cookies development?
     
    Last edited: Aug 7, 2018
  25. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!
    Thanks for your interest.
    The status of these 2 features is still in development. I don't have any ETA to share because it requires some massive optimization so they could run on mobile, which is quite a challenge.
    However, like mentioned in a previous post, I have a working WIP version of these features. This version has some limitations and won't run on mobile at all, but if you need it to run on PC, it can be fine. I would be happy to send you this version if you want, please send me an email at techsaladunity@gmail.com.
    Thanks
    TS
     
  26. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    282
    I'm having an issue with certain areas of certain models showing artifacts when behind or inside of the cone for the light.

    I've tried every setting and can't seem to get rid of it.
     

    Attached Files:

  27. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!
    Sorry for the problem you are experiencing.
    It definitely looks like an issue but I never encountered something like that .
    Do you think it would be possible to share your scene (or at least this part of the scene) with me so I could investigate on my side? I understand if it's not possible though.
    Otherwise could you keep your camera at this position, and slightly move the beam please. Do the artifacts disappear? Are they visible on other parts of the scene? Maybe could you record a video of this so I could see the result?
    If you prefer we could continue the support privately at techsaladunity@gmail.com
    Thanks!
     
  28. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    282
    I'
    I'll go ahead an record a video and send it to you.

    EDIT: I ended up sending a UnityPackage to you instead.
     
    Last edited: Aug 11, 2018
  29. sisocano

    sisocano

    Joined:
    May 6, 2015
    Posts:
    13
    Hi there
    is the the light needs collider to work correctly or can beam at any mesh without collider?
     
  30. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!

    If you talk about colliders on your scene, only the "Dynamic Occlusion" (http://saladgamer.com/vlb-doc/comp-dynocclusion/) feature require them. Pieces of geometry without colliders won't be considered as potential occluders.

    If you talk about collider on the beam itself, only the "Trigger Zone" feature (http://saladgamer.com/vlb-doc/comp-triggerzone/) uses a MeshCollider on the beam (but it's procedurally generated, you don't have to manually attach a collider).

    Hope it's more clear.
    Thanks!
     
  31. sisocano

    sisocano

    Joined:
    May 6, 2015
    Posts:
    13
    Hi thanks for replay

    what i want to know, is the light can be blocked by any gameobject without collider,
    or all object must have collider to block the light from passing throught.

    i want to make somthing like lazer light that will be blocked by any gameobject in my scene
    is that possible?

    thanks
     
  32. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi,
    No, an object must have a collider in order to block a beam of light:
    http://saladgamer.com/vlb-doc/comp-dynocclusion/
    Since this features relies on raycasts to work, a piece of geometry MUST be represented with a physical entity for Unity in order to be considered as a potential occluder. This means a 3D Collidercomponent MUST be attached to it (BoxCollider, SphereCollider, MeshCollider...).
    Do not hesitate if you need more info.
    Thanks
     
  33. sisocano

    sisocano

    Joined:
    May 6, 2015
    Posts:
    13
    thank you very much for information.
     
  34. zIyaGtVm

    zIyaGtVm

    Joined:
    Dec 27, 2017
    Posts:
    44
    Hi, Could this Trigger Zone achieve Rect Shapes like this? Thanks.
    collider.png
     
  35. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi!
    No the trigger zone has the same shape than the light beam. Since the current version of the plugin only supports spotlights, their shapes are basically truncated cones. So no you can't make trigger zone shaped like the complex geometry in your screenshot.
    Thanks
    TS
     
  36. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    182
    Hi @techsalad -- great asset, I purchased yesterday -- it's similar to another I was using but way better in terms of features / visuals and the occlusion looks great. For some reason I can't see the occlusion working in my project, however I'll investigate that further... does the physics collision matrix affect occlusion?

    Very interested in the rectangular light beams too, as I'm using lots of strip lights. I'm running high-end VR on PC, so hopefully your WIP version can work there? I'll send you a direct email on this topic too. Thanks!

    // WildStyle
     
  37. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi,
    Really glad you like the asset :)
    Regarding dynamic occlusion, no the collision matrix shouldn't affect this feature. Let me know if you can't figure it out.
    Thanks.
     
  38. techsalad

    techsalad

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

    I am really excited to announce that the Volumetric Light Beam version 1.50 has been released. This update is all about optimization. You can expect a speed bump between 1.5x and 3x !

    The beam shader has been greatly optimized. A lot of code has been refactored and moved from the fragment to the vertex shader. This brings some huge performance improvements, specially for complex beams with lot of features enabled (3D Noise, gradient color...).

    The downside of this optimization is that more tessellation is required to achieve the same rendering quality. A new “segments” property has been introduced to control the geometry tessellation along the beam. To sum up, the beams generate more polygons, but are much faster to draw.
    prop_segments_8.png

    However to compensate for the higher polygon count, we developed a new feature: shared mesh.

    Until this new version, each beam used to generate its own beam geometry. It is still possible to get this behavior by selecting “Custom Mesh” on your beam. But with “Shared Mesh”, all you beams can share a single mesh instance, drastically reducing the memory footprint and loading time.
    Screenshot_4.png Screenshot_5.png

    We strongly recommend to use the Shared Mesh feature, and to use a Custom Mesh only for specific beams which needs a higher polycount for some reasons (larger/longer or more visible beams).

    Please note that by default, every new beam created will use the shared mesh feature. But to keep the backward compatibility with previous data, all the beams created before this update will still use a custom mesh with the specified tessellation properties. But I would recommend to manually switch them to shared mesh.

    To give you real-world numbers, here are the results of some benchmarks on some mobile devices:

    100 Volumetric Light Beams | 32 sides | Most features OFF (3D Noise disabled, no soft blending, flat color)
    • Fire 7 Tablet (2015)
      • version 1.42: 18 fps
      • version 1.50: 38 fps (x 2.1 faster)
    • HTC Sensation (2011)
      • version 1.42: 10 fps
      • version 1.50: 16 fps (x 1.6 faster)

    100 Volumetric Light Beams | 32 sides | Most features ON (3D Noise enabled, soft blending on, gradient color)

    • Fire 7 Tablet (2015)
      • version 1.42: 6 fps
      • version 1.50: 29 fps (x 4.8 faster)
    • HTC Sensation (2011)
      • version 1.42: 5 fps
      • version 1.50: 12 fps (x 2.4 faster)


    In addition to these improvements, this new version introduces new features such as:

    Hope you’ll enjoy this big update!
    TS
     
    Last edited: Aug 20, 2018
    tntfoz, Akshara, zIyaGtVm and 2 others like this.
  39. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    385
    EDIT: All I had to do was delete the previous version and re-import the new version. Just doing an update from the Asset store didn't work. I'll leave this message here just in case anyone else runs into it.

    I just installed your latest update 1.50. I'm using Unity 2018.2.2f1.

    I'm getting failed to open source file: "VolumetricLightBeamShared.cginc" on the shader.

    The result is anything using the shader is pink because the shader code is broken.

    Any suggestions?

    Thanks
    Allan
     
    Last edited: Aug 21, 2018
    wetcircuit likes this.
  40. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Thank you for your message and for the update.
    Yes I did some changes regarding file and folder names. Unfortunately Unity doesn't seem to handle that properly when updating an asset.
    Like you said, the best way is to close Unity, completely delete the "Plugins/VolumetricLightBeam" folder, and reimport from the AssetStore.
    Thanks
    TS
     
  41. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    385
    Have you had anyone use your Volumetric Light Beams on pooled objects? I'm having some problems.

    I have your Volumetric Light Beams attached to weapon objects that are pooled. I use the light beams to help the player identify the weapon that he has dropped so he can easily see it in the terrain. When my character falls and drops his weapons, there is a huge pause in the game when the Volumetric light is turned on for the first time. Each subsequent drop there is no pause. The huge pause only occurs on the first drop.

    I've identified the problem:
    When I look at my pooled weapon objects with Volumetric Lights in the inspector after pressing play, in the Volumetric Light Beam script there is an error that says "Fail to load 3D noise texture. Please check your config." When I select the global Config.asset and look at it in the project, the 3D noise texture is connected and when I go back to the pooled weapon object, the error has disappeared. So just the act of selecting the Config.asset makes the error go away. After selecting the Config.asset file and making the error go away, when I drop the weapons, there is no pause in the game.

    There is some kind of problem with your Config.asset connection to the Volumetric Light Beam script that doesn't like being pooled and disabled upon game startup.

    Thanks
    Allan
     
  42. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Thank you for this information.
    No I haven't tried to pool the beams.
    But what do you exactly mean by "pooled"? Do you use a specific asset, or a custom solution to do that? Because I don't know any "standard" way of pooling objects in Unity.
    Where are the pooled beams stored? In a ScriptableObject? Do you create N pooled beams at startup, or are they created on the fly when needed?
    Thanks
     
  43. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    385
    Oh sorry I deleted that info out of my original post once I figured out exactly what the problem was.

    I am using Poolmanager by Path-O-Logical games from the asset store. Docs. I like it because I've used it in two previous published games and it has a standard straight forward concept for pooling. Upon startup, it instantiates a predefined number of objects and then disables them until you need them. When you spawn them, you are simply enabling a pooled object that already exists in your scene. If you're doing mobile development, you have to pool otherwise you'll see huge framerate spikes with every instantiate and destroy. So you absolutely have to pool everything.

    I'm not doing anything with scriptableobjects relative to your Volumetric Light product. The Volumetric Lights are simply child objects on my weapon object prefabs. The weapon prefabs are spawned/instantiated by the pooling system at startup, disabled and then stored in a pool until I need them. When I need them, I simply spawn them...which just enables the disabled instance that is sitting in the pool waiting to be used.

    I'm guessing somewhat here but I think the problem is your scriptableobject Config.asset as used by VolumetricLightBeam.cs is not creating a reference to the noise texture early enough and thus you see the error, "Fail to load 3D noise texture. Please check your config." on the disabled pooled volumetric light.

    I was able to fix this problem by simply turning off the 3D Noise Enabled option and this turns off the need to reference your Config.asset scriptableobject 3D noise texture.

    Thanks
    Allan
     

    Attached Files:

  44. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Thank you very much Allan for these information.
    I investigated and I found the problem. Like you mentionned, the "pause" happening the first time you instantiate a beam is caused by the loading of the 3D Noise texture. The 3D Noise texture is only loaded when:
    - the 1st beam (with this feature enabled) is enabled in the scene
    - you select the Config asset in editor

    So to prevent this from happening, the trick is simply to load the 3D Noise texture on startup. Please try to put this script anywhere in your project:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public static class Load3DNoiseOnStartup
    4. {
    5.     [RuntimeInitializeOnLoadMethod]
    6.     static void OnRuntimeMethodLoad()
    7.     {
    8.         VLB.Noise3D.LoadIfNeeded();
    9.     }
    10. }
    Let me know if it fixes your issue. If it works, I will include this behavior in the next update.
    Thanks
    TS
     
  45. chaneya

    chaneya

    Joined:
    Jan 12, 2010
    Posts:
    385
    Glad I was able to help.

    And thanks for the quick solution. I'll just wait for your next update. If I put that static script somewhere in our project, given the size of our project, I'll lose track of that and forget it's purpose over time.

    For my own education since I'm fairly new to scriptableobjects, I'm assuming it's the Resource.Load in the Config.cs Reset method that is causing the spike. I'm guessing the behavior you're thinking of including in the next update is to move that Resouces.Load command so it occurs at startup if the user has selected to use 3D Noise. You may also want to do that with Shader.Find. That will ensure that your setup process occurs at startup if spawned during the pooling process and be already in memory when the object is enabled for the first time during runtime.

    Thanks
    Allan
     
  46. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    No it's the actual texture loading of the 3D Noise data which is causing the spike. This is the internal Noise3D.LoadTexture3D function. And so my solution is to call that at startup to prevent any spike from happening later.

    Shader.Find is actually not called at runtime. It's only used in editor. The links to the shaders are serialized in the Config ScriptableObject, so no Shader.Find call is needed at runtime.
     
  47. austinGENEreeve

    austinGENEreeve

    Joined:
    Mar 29, 2017
    Posts:
    1
    Hey I just went to the new update and I'm getting 9 different errors?

    Shader error in 'Hidden/VolumetricLightBeam1Pass': failed to open source file: 'VolumetricLightBeamShared.cginc' at line 70 (on metal)

    Compiling Vertex program
    Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER2 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING
     
  48. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi,
    It's a regular issue when updating assets in unity. Sometimes it fails to properly update the files. Please follow these steps: http://saladgamer.com/vlb-doc/troubleshooting/#errors-after-updating-the-plugin
    Let me know if it works!
    Thanks
     
  49. peterng1618

    peterng1618

    Joined:
    Sep 6, 2018
    Posts:
    1
    Hi techsalad,

    I'm considering purchasing this. But my biggest concern is it needs to work with HDRP. Could you confirm it's please

    Many thanks.
     
  50. techsalad

    techsalad

    Joined:
    Oct 9, 2017
    Posts:
    164
    Hi and thanks for your interest,
    I worked on the LWRP and HDRP support and I have a working version. It will be included in the next update. I will probably publish it next week.
    Thanks
    TS
     
    peterng1618 likes this.