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

Hi @bawenang
I wanted to let you know that I’m working on the feature. Some pretty big changes are mandatory in order to be able to modify/animate properties such as the spotlight angle without having to regenerate the full mesh each frame (which would be terrible performance-wise).

I have now a WIP version of this feature running. Basically it will allow to modify via Script or via Animator (almost) every properties of the Light Beam and/or of the Light during playtime. The only properties you cannot modify is the number of sides of the cone mesh (the tessellation), because it would obviously require to regenerate the mesh. But I think it’s a really minor limitation :slight_smile:

Here is a sneak peek video of this feature:

If you are interested in having a pre-version of this feature before the release, please send me an email (techsaladunity@gmail.com) with your invoice number. This way you could check if the feature fulfills your needs, and I could work on some modifications if needed.

Thanks

2 Likes

Wow. Thanks for the swift reply.

Hi,

I’m configuring the Light Beam for our scenario (just bought your product, which is absolutely brilliant), and I’m noticing that when a spot light is turned off and the player turns it on at runtime, it takes some moment - freezing everything - in order to generate the mesh…

After that, it works properly and it has no impact on the performances, but this lag - while turning on the light - is quite annoying.

Can we avoid the runtime generation, providing a pre-generated cone mesh?

Obviously, if you have any other suggestion, it should be great!!

Thank you,
Emanuele

Hi Emanuele,
Thank you for your kind words and your purchase :slight_smile:
I am really sorry about the issue you are experimenting. To be honest, I haven’t thought at this scenario.
I haven’t investigated yet, but I’m confident it could be fixed quite easily. I will take a look at it next week and I’ll keep you you updated.
Again, if you are interested in receiving a pre-version once I will a fix working, feel free to send me an email with your invoice number at techsaladunity@gmail.com
Thanks :slight_smile:

Thank you again for your support! :slight_smile:

I haven’t the time to investigate properly, but maybe the creation of the mesh at runtime is not the cause, as I (wrongly) said previously. Because I noticed that after the creation of the first cone (with the lag issue), the next ones (we have several spot lights which can be turned on/off) are created instantaneously without any lag! :eyes:

So, the lag happens only the first time and thus it seems that the creation of the mesh is not the resposible of this issue. Sorry, my mistake!

Instead, going deeper, I debugged the Config class - called while instancing, so just exactly the first time! - I noticed that the line 57

var found = Resources.LoadAll<Config>("");

is very very slow… and I think we found the cause of the first-time-lag. Also, in order to give you a more accurate idea, we are working on huge scenarios - thousands of Gameobjects :hushed: - so, maybe the LoadAll method searches in all the Resource folders… and this can take some time!!

Obviously, if you need some more detail, just let me know!
Thank you again,
Emanuele

Hi Emanuele,
Thanks for your very precise report. I just ran some profiling and indeed, this unique call (which only happens the first time) can be quite slow. As a quick fix, could you try to just change this line of code with instead the following:

var found = Resources.LoadAll<Config>("Config");

It seems to be way faster. Please let me know if it works with your scenario.

In case it’s still a problem, another quick fix would be to force this call during loading to prevent it to happen during gameplay. So you could just “touch” the Config instance in your loading code. Something like that:

void YourLoadingCode()
{
    VLB.Config.Instance.GetInstanceID(); // force the initialization of VLB config during loading
    // load your stuff
    // ...
}

Please let me know :slight_smile:

Yeah!! :):slight_smile:
Perfect! You hit the target.

I just used your first suggestion and the lag disappeared. Thank you again!
Emanuele

1 Like

Thanks for the feedback! Really glad that this issue is now fixed for you, but sorry for the inconvenience!

This fix will be part of the next update to be released.

1 Like

Hi @bawenang
The feature to dynamically animate beams in realtime is done, and I am so excited about it!!! :).
It allows to dynamically modify properties during playtime from Script, from an Animator or from a Timeline asset (new feature of Unity 2017). That’s pretty cool!

To enable this feature, you will have to check a new property called ‘Track changes during Playtime’ on the Beam(s) you want to modify.
3279884--253705--Screenshot_11.png

Once enabled, you can modify every properties expect “Sides” and “Cap Geom” (because they would require to regenerate the mesh). Thanks to a quite deep refactor, all the computations are now done on the GPU: modifying in realtime properties such as the “spot angle” or the “truncated radius” are now almost free performance-wise.

However, to be totally honest and transparent, enabling this feature requires to update the beam material at each frame, which could cost a very minor performance drop if enabled on hundreds of instances. That’s why this feature is disabled by default, and I would recommend to enable it only on beam instances you really want to animate.

The update will be submitted soon to the AssetStore. If you want to receive it before, let me know :slight_smile:
Thanks

1 Like

Hi,

Can the spot light have a cookie texture to determine its shape?

Hi Gamrek,
If you set a cookie texture on your spotlight, it won’t change the shape of the beam (which will stay as a cone). This feature is currently not supported, but is part of the development roadmap.
Thanks for your suggestion!

The update 1.11 is now live on the AssetStore. Here is the changelist:

  • Support property changes during Playtime: you can now dynamically animate every properties of the beam and/or the spotlight via Script, Animator or Timeline. Make sure to check the new ‘trackChangesDuringPlaytime’ property to enable this feature (thanks to suggestion from bawenang)
  • Performance improvements (thanks to report from Thoronnim_Crystalia)

I didn’t have the time to produce a video showcasing this new improvements and features yet, but I will do it next week.

The next update 1.12 will be available very soon and will fix some minor issues related to the multi-object editing features.

2 Likes

very nice asset! I’m happy, I have one question about the spotlight, the the camera look directly in the spotlight you would expect the view to become bright so that your blinded by the light, what happens instead is that the light almost disappears, so the effect is less strong, Is there something that I can do to make it more bright when facing the spotlight directly head on?

Hi Lars,
Thanks for your message, and I’m glad that you find the asset useful!
If you are not satisfied with the rendering of the beam when you look at it from the inside, try to tweak the values below the “Inside” category. The “Boost Distance” property is specially designed for this case: boosting the beam intensity near the source when you look from the inside.
3288783--254628--Screenshot_12.png

I think this should fix your problem. Please let me know :slight_smile:
Thanks

When looking from behind the light beam becomes less visible and when looking directly from behind it is invisible. Do you think you might find a way to fix that without hurting the excellent performance?

1 Like

Hi Vic,

Thanks for your feedback. I want to properly understand the issue before trying to fix it :slight_smile:

My point is that the beam is supposed to become less visible the more you look at it from behind.
The more the camera is behind the cone beam, the more the camera view and the beam cone directions are parallel/collateral. And so the less it’s supposed to be visible.
3289509--254711--Screenshot_13.png

With the current version, the parameter which controls how visible the beam is compared to the camera position (when looking from the outside) is “outside side thickness”. A larger thickness means the beam will be more visible when you are behind it, but also when you look at it from the side, which is maybe not what you want.

If you are not satisfied with the result in a specific situation, I would be happy to investigate. In this case, I would really appreciate if you could share to me more details about your case (the more the better) like:

  • the exact properties values of you beam (screenshot of the inspector)
  • screenshots and/or video of the result ingame/in editor highlighting the problem
    (If you don’t want to share this info publicly, please send me an email at techsaladunity@gmail.com)

Looking forward to helping you :slight_smile:
Thanks

I boosted the inside but now I have a sharp edge on the beginning of the spotlight, any way I can remove that?

Looks awesome!

Regarding the sharp edges, I think that’s because your “boost distance” is too big. But I guess you had to put it very large in order to have the effect you wanted when looking at the beam from the inside.

I can investigate on a way to improve the rendering when looking in the same (or opposite) direction than the beam. This should cover bother your and @VIC201 cases. Like adding a “glare” factor.

Please send me an email so I can send you a WIP update of the asset ASAP. This would help me designing this feature to fully satisfy your needs.

Thanks

I want to create ship search lights with it.

I’ve played around a lot with it today to figure out if I can find a setting that works as I wanted but the borders of the beam are either to hard or not visible when looking from behind.

The problem is the Outside only. A side thickness of 0.9 is the best compromise so far to get the light beam when looking from behind. But the beam looks way too hard at this settings when looking from any other angles – while this would be convincing for a strong search light at a super clear day it would not be convincing as soon as it gets a a little bit foggy.

The look I want is similar to this (At 00:28 you can look at the light from behind in this movie)

https://www.youtube.com/watch?v=YPgEjVJ8l0I

This is a search light at a clear day:

https://www.youtube.com/watch?v=R9NMyiAzfvk

This is what I’ve made with in a test project. I’ve found no better settings yet, I think the beam itself is smooth enough but I wish I could boost the light much more when looking from behind. I also would like to boost the Inside more but then both will add up too much quickly so I have to reduce its alpha.

https://www.youtube.com/watch?v=9qNchb9Nyo8

Hi Vic.
Thanks for your message.
I currently work on an update to improve the rendering. I think you will like it.
Please send me an email so I could provide you a WIP version you could try.
Thanks