Search Unity

2D Mesh Based Volumetric Lights

Discussion in 'Assets and Asset Store' started by reveriejake, Jul 5, 2012.

  1. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Also just to let everyone know... I have discontinued the current version of 2DVLS from the asset store. Those of you who have already picked up a copy should still have the ability to download your copy from the asset store or from GitHub.

    A bit about the code I am working on now... I am planing to release the next update for Unity 5+ under the name VLS2D. I have had sort of a pep talk from a friend of mine who assured me that despite the recent events with 2DVLS and my lack of support there are people who still support me and would like to see a proper bug-free update. So he sort of motivated me to continue with the project.

    I do not have an expected release date though :(

    Jake
     
    Shadeless likes this.
  2. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Awesome! That's great to hear. Apart from the small few bugs it's exactly what I need, and also works super well. I seen on your FB that you wanted to see what was being made with 2DVLS, and I actually use it for quite a few things in my game, but mainly enemy vision cones and a small radial beam from lights at the moment. Next up is using it for the flash from a stun grenades! So yeah, it's been a very useful asset :)
     
  3. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    Awesome! Thanks for the screen grab. It looks like you are actually using it in the way it was intended as well.

    Could you answer a couple questions:
    What do you think about being required to use Obstructers?
    How is performance?
    What do would you like to see in the next version?
    Did you have to make your own cone detection code? How did you do that?

    Jake
     
  4. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    Hi, sorry for the delay

    What do you think about being required to use Obstructers?
    Obstructors were not a problem for me. The game is tile based, so I just needed to attached the obstructor script to each of the various tile prefabs. I could also have created a script to assign the obstructor component to any tile of a certain layer type, if I needed it done at runtime

    How is performance?
    I did a quick test there. I didn't notice any performance decrease when they're static/not moving, but when they are moving and there's multiples on screen at once there seems to be a significant drop (From 130 to below 60 when there was more than 8 - 10 moving on screen at once)

    What do would you like to see in the next version?
    I have already created my own vision detection so that's not necessary for me, but I'm sure other people may want something like this.

    On the older version there was a fog of war option. Are you planning on having this again? Or is it there and I just can't find it :S This would be incredibly useful as I plan on having it in the game!

    One thing I was actually trying to do (and totally not necessary for the asset), was to highlight the edges of the cone with a white line (like in the debug mode where you use the Drawline method to highlight the edges). I tried some quick ideas, firstly to use edge detection but it's a flat mesh so didn't work out as planned, and I also tried a line renderer using the vertices listed in the script, but the line renderer itself is a bit awkward and warps when there is multiple angles. I wanted to use this to highlight the vision cone a bit more, and like the way it looked in the scene view, but it would also be cool for a radar type effect or a visual way to show the blast radius of damage for a bomb :D

    Did you have to make your own cone detection code? How did you do that?
    Yep, I created my own cone detection, which was fairly straight forward. Firstly the cone is a separate gameobject than the enemy model, and can rotate to allow the guard to look around. I created a circular collider with the same radius as the vision cone. When the player, or another object of interest, enters this collider, it detects this using OnColliderEnter/Stay/Exit. It checks if the object of interest is positioned within the field of view of the vision cone, and then uses the drawline function to see if there is a direct line of sight to the player or if something is in the way. If there is a line of sight, then it calls on one of the various behaviors for the enemy
    I hope that makes sense?
     
  5. reveriejake

    reveriejake

    Joined:
    Jul 8, 2007
    Posts:
    819
    @Guacamolay - Thanks for the info.

    Performance
    I am wondering how often people move more than 2 or 3 lights around while they are in view. Technically the light shouldn't update unless it is in view. It should only update the lights vertices and bounding box. This is not to say that I am ALWAYS looking for ways to cache more data, improve performance, and reduce the memory footprint/CG calls...

    Fog of War
    I am sure there must be better solutions somewhere for Fog of War than 2DVLS. I might consider making an add-on for Fog of War?

    Highlight Edges
    Highlight edges would be cool :D. I think I could either completely implement that or at very least provide a function that returns a list of vertices that outline the edges of the light.

    Cone Detection
    That's an interesting method. I wonder how accurate it is though if you are only testing the center point of the collider when you are checking for line of sight. I might have to look into a better solution for that.

    Jake
     
  6. Guacamolay

    Guacamolay

    Joined:
    Jun 24, 2013
    Posts:
    63
    For performance, I probably will have more than two to three vision cones on screen at once, as the enemies may chase the player etc. However I do plan on limiting this, as I don't want it to be too chaotic, so I doubt I'll need a large amount on screen. Would 5 to 6 on screen at once be possible?

    The cone detection method works quite well, and I test for numerous points along the players boundaries to make sure he will get spotted when he should, but if you want to look into an alternative, I'd be interested in seeing what you come up with :)

    A fog of war add-on would be great, as would the highlighted edge effect :D
     
  7. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    811
    Hey man! I am looking forward to the new version!! I bought your asset awhile back and would love an update :)

    I have to say I LOVE the asset and my game loves it too :)

    I seriously cannot wait for it. I will definitely share a SS when the game is in a more presentable state.

    Is there going to be a pro version or is it all completely free?
     
    Last edited: Nov 2, 2015