Search Unity

[FREE] GPU Line of Sight / Field of View

Discussion in 'Assets and Asset Store' started by Tycho, Jul 16, 2014.

  1. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi,

    Thanks for raising this issue. I've just tested with version 5.3.2 and everything seems to work as expected.

    I'll download the latest Unity version and see if I can reproduce the problems you're experiencing.

    EDIT:
    After re-reading your post, I better understand the issue you're describing.
    In the example scene the Player Info script (which uses the LOS Visibility Info component) checks the tag of the LOS source and makes sure the players own LOS sources are excluded.

    For now it's the responsibility of the script using the LOS Visibility Info events, or list of visible sources, to exclude the LOS sources which are invalid. It was designed as generic as possible, so that it could be used in a number of different situations and projects.

    I could add extra functionality that would ignore objects on layers which are set as invisible to the LOS source camera using the Culling mask property.
     
    Last edited: Jun 5, 2016
  2. krisz-konya

    krisz-konya

    Joined:
    Aug 28, 2015
    Posts:
    5
    Thank you for your answer, I understand now.
     
  3. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    Hi,

    Would your plugin allow to do such an effect, with a cone of sight on several heights?




    Cheers,
    Nicolas
     
    Last edited: Jun 11, 2016
  4. Nicolas-Liatti

    Nicolas-Liatti

    Joined:
    Jun 19, 2013
    Posts:
    89
    I purchased the plugin, but I have a problem: I would need to represent the filed of view in "3D".

    See the example on the screenshot: the top of the platform is in the cone of sight, and it should thus appear in green.


    How can I do this?

    I tried to put the camera higher, but it's not an option because in this case the enemy would see behind of the wall...
    So what I need is to represent the camera in "3d", like a volume, not just on the ground. How can I achieve this?

    Thanks
     
  5. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Version 1.3.0 has been submitted to the Asset Store and should be available by the beginning of next week.

    The major improvement in this version is the option to exclude backfaces from the Line of Sight mask, which should remove common artifacts. This option excludes the faces which are facing away from the LOS source from the mask and can be enabled and tweaked per source.

    Here's an example of the option disabled and enabled, the difference is very obvious at the top of the walls and on the curves of the sphere and capsule.:

    Exclude-backfaces.jpg

    Here's the complete changelog for version 1.3.0:

    - Added backface settings to LOS Source component to remove common artifacts
    - Added headers to LOS Source component
    - Removed LOSSourceCube component (deprecated in version 1.2.2)
    - Removed Blur (experimental feature)
     
  6. JacobDzwinel

    JacobDzwinel

    Joined:
    Dec 19, 2013
    Posts:
    26
    Hi Tycho, any chance of a discount price soon? I would love to start work with this asset as fast as i can ;)
     
  7. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi,

    I'll apply for another Unity Asset Store sale, but if and when it will happen depends on Unity :)
     
  8. JacobDzwinel

    JacobDzwinel

    Joined:
    Dec 19, 2013
    Posts:
    26
    Can you check if everything working fine with your asset in new Unity 5.5 version? Especially in orthographic camera projection (not top down). Thanks!
     
  9. neill94

    neill94

    Joined:
    Mar 3, 2013
    Posts:
    6
    Hey, we brought this asset a few days ago and are having issues getting it working with our Deferred rendering camera setup, with the exclude depth camera also using deferred.

    You've noted in your documentation that this is an issue with Unity 5, but the description on the asset store still says that deferred rendering pipelines are supported.

    Have you had any luck finding a alternative solution, as it's quite vital to make this asset work?
     
  10. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Sorry for the delay in replying, but I had some issues login onto the forums.

    All features are supported in deferred rendering except the camera exclusion script. I'll check if the issues blocking a fix have been resolved in Unity 5.5 once I'm back from holidays next week ;)

    One thing you can try is to set the second camera rendering path to forward.
     
  11. neill94

    neill94

    Joined:
    Mar 3, 2013
    Posts:
    6

    Hey, hope you had a great Christmas and New Year break!

    I'm still having issues getting the asset working with our Deferred camera setup. I've tried what you suggested by setting the second camera (Player camera) to forward and leaving the main camera as Deferred, but this results in the player being rendered in-front of walls and everything rendered on the main camera as shown in the screenshot below.



    I've also tried this in the included demo project, with the same results.



    Even when both cameras are set to forward, it seems that lighting isn't altering models rendered with the exclude camera. Also copying all of our camera effects over 2 cameras in-order to make objects rendered by both cameras look consistent doesn't sound that efficient, nor the ideal solution due to our deferred workflow.



    Finally, if the exclude camera is disabled and the player's layer is rendered by the main camera, the player model is permanently dark as expected from the documentation.



    Isn't there any other way to have the player unaffected by the line of sight algorithm and just environmental lighting, whilst using Deferred rendering without an additional camera?

    Thanks for your help in advance, we really want to include this asset in our project as it'll be one of our core mechanics.
     
  12. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Sorry to hear the fix I suggested didn't work.

    I'll try to figure out another way to exclude objects when using deferred rendering tomorrow.

    I'll keep you posted on the progress ;)
     
  13. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Okay,

    Looks like I've found a better solution for excluding objects from the Line of Sight, which doesn't require multiple cameras, and which works in both forward and deferred rendering paths.

    It will take a couple of days to implement and test properly, but I'll let you know once it's done ;)
     
    Last edited: Jan 5, 2017
    neill94 and movra like this.
  14. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Everything seems to be working fine in Unity 5.5.
     
  15. neill94

    neill94

    Joined:
    Mar 3, 2013
    Posts:
    6
    That sounds great!

    Looking forward to seeing the solution :)
     
  16. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    The new feature for excluding objects is almost ready for testing.

    If anyone wants to help with testing, just send me a PM with your email address and invoice number ;)
     
  17. jrhee

    jrhee

    Joined:
    Dec 5, 2013
    Posts:
    74
    Hi,

    Just getting set up with the plugin, but I noticed I'm getting an assert fails when creating mat for the LOS Mask:

    Looks like the mask shader fails with the error:

    Any ideas how I can get around this?

    Thanks,
    John
     
  18. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi John,

    Do you see this error in the editor or when trying to build?

    I think you're either using or emulating an old Graphics API that only supports Shader Model 2 (SM2.0), while this asset requires Shader Model 3.
    Check which Graphics API is selected in your Player settings, and if Graphics Emulation is set to Shader model 3 or higher.
     
  19. jrhee

    jrhee

    Joined:
    Dec 5, 2013
    Posts:
    74
    That fixed it- Windows graphics API was set to D3D9 for some reason. Thanks for the quick reply!
     
    Tycho likes this.
  20. grllle

    grllle

    Joined:
    May 4, 2015
    Posts:
    28
    I started integrating the plugin in our project (Unity 5.5.0f3, deferred rendering) and it works like a breeze so far!

    Hope you can help me with some questions:
    1. Using the distance fade I experience wrong transparency comparable to rendering transparencies using wrong alpha blending (see the attached screenshot).
    2. Changing the project to linear space stops showing the mask at all for me (also in the example project)
    3. Do you have an idea, when excluding layers will be available again? This is a crucial feature for our setup.
    4. Maybe I get it wrong but shouldn't the invert mask option be a property of the LOSMask rather than the sources? Because inverting several sources seems to cancel itself out.

    Thanks in advance and thanks for the awesome plugin!

    los.png
     
    Last edited: Jan 27, 2017
  21. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi,
    Glad you like the asset so far :) I'll do my best to answer your questions:

    1. The distance fading does look incorrect in the screenshot, I'll look into what's causing this issue
    2. I've just tested the asset with Unity version 5.5 and it does work as expected with linear color space enabled. Could you post a screenshot of what it looks like on your machine after switching?
    3. I'll submit the new update, which includes the new method for excluding objects, to the Unity Asset store next week. Send me a PM with your invoice number if you'd like to receive it before then, because the approval process does take some time ;)
    4. I might indeed need to rethink or scrap the invert mask feature, because now it only works with a single LOS source. Inverting the entire mask would also cause some strange side effects, since the color for each LOS source is rendered into the mask.
     
  22. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Version 1.4.0 has been approved and is now available on the asset store!

    Here are the release notes for this version:
    • Made asset compatible with Unity versions 5.2 and up
    • Added new method for excluding objects while using the deferred rendering pipeline
    • Added LOS Stencil Mask component
    • Added LOS Stencil Renderer component
    • Deprecated LOS Final Resolve component
    • Fixed LOS Source distance and edge fade blending
    • Fixed LOS Mask shader trying to compile to SM 2.0
     
    Last edited: Feb 17, 2017
  23. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
  24. Chris_Entropy

    Chris_Entropy

    Joined:
    Apr 11, 2011
    Posts:
    202
    I understand this correctly, that this asset allows you to visualize the field of view in 3D space? So it is not just usable for top down games, but also for full 3D games?
     
  25. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Yes, that's correct, it supports both perspective and orthographic cameras in a 3D space.

    2D sprite projects are not supported tho.
     
  26. grllle

    grllle

    Joined:
    May 4, 2015
    Posts:
    28
    Hey there!
    It seems as if the LOSSource culling (TestPlanesAABB against camera frustrum) is broken, leaving m_IsVisibile always true. Can somebody confirm if this is just me?
     
  27. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi Bernhard,

    Which version of unity are you using? I've just tested the example scene with version 5.6.0f3 and everything still seems to work.
     
  28. FunkyUserName

    FunkyUserName

    Joined:
    Jun 27, 2015
    Posts:
    8
    hello,

    awesome system, just some problems (Unity 5.5.3f1):

    1. the shadows make it look night, which is a major drawback for me. i dont care about the shadows at the sidewalk which are below source cameras ( increasing height of cameras wont fix the problem).

    2. Is it possible to change the colour of already visited areas (from dark black to grey)??

    3. on game start i get the error msg: Dimensions of color surface does not match dimensions of depth surface (using stencil mask)

    4.i also cant use stencil mask + LOS Layer excluder because it ends up with not rendering things i want to be rendered + invisiblity artifacts on units
     
    Last edited: Jun 4, 2017
  29. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    1 & 2: Yes, you can change the effect applied to the area outside of the line of sight to anything you want and make it less dark. Just replace the included desaturate effect with another image effect (such as the ones included in the Unity standard assets). You can also combine several image effects.
    3: I'll look into that, but if it only appears once you shouldn't worry about that error.
    4: You can't combine the LOS Object Hider script with the Stencil Renderer script, because the stencil renderer will always render the object, even if it's outside of the line of sight, since it's purpose is to exclude objects from the Line of Sight.
     
  30. FunkyUserName

    FunkyUserName

    Joined:
    Jun 27, 2015
    Posts:
    8
    ok thx i will look into image effects.
    to 4. in most rts -ish games units dont block vision and disappear under the fow. if i disable stencil mask the units will have a shadow.
    is there no way to have them excluded from the LOS-System and disable rendering under fog of war?
     
  31. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Yes, to prevent objects from affecting the line of sight, please refer to section 2.3 of the manual.You can combine this technique with the LOS object hider.
     
  32. FunkyUserName

    FunkyUserName

    Joined:
    Jun 27, 2015
    Posts:
    8
    Yes but it doesnt look good (units become dark on the back) :

    or am i doing anything wrong?
     
    Last edited: Jun 6, 2017
  33. AntonioModer

    AntonioModer

    Joined:
    Jul 29, 2014
    Posts:
    65
    Hi @Tucho.
    I want buy this asset, but I'm not exactly sure how it works in 3D view, i need to see and test it.

    Please make and give 3D-perspective-camera demo of this asset (best decision), or make video.
    And it will be useful, if Manual (or some part of it) is be in open access.
    So that peoples can read Manual before buying asset, and decide whether this asset is suitable for them.

    I have question:
    asset is work with MeshRenderer component wich use parameters "cast shadows" = "shadows only" and "Receive Shadows" = "false"?

    question.PNG
     
    Last edited: Jun 14, 2017
  34. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    The images aren't working anymore, could you re-upload them?
     
  35. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    If you send me a PM with your email address, I'll send you the documentation.

    The asset should work with that MeshRenderer configuration.
     
    AntonioModer likes this.
  36. ChrisHorrigan

    ChrisHorrigan

    Joined:
    Jan 28, 2014
    Posts:
    11
    Hi,
    I'm working in Unity 5.5.4 and I'm converting a project that uses this tool into a virtual reality project for the Vive. It seems like I might need to modify the shaders in some way to make it look right. This is what I normally see: http://imgur.com/vqUkRf8
    This is what I see in VR with multi pass rendering (and that sort of focal point moves to the right if I tilt my head differently): http://imgur.com/4iRQgei

    I'm not very familiar with how shaders work at all, so I was hoping I could maybe get some advice about what to change in order to replicate the normal experience in VR. Thanks!
     
  37. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi,

    The changes you need to make to the shaders to support single-pass stereo rendering are outlined here: https://docs.unity3d.com/Manual/SinglePassStereoRendering.html

    I want to add support for single-pass rendering in the next update of this asset, but due to my current workload I have no idea when I'll have time to work on it :/
     
  38. Dreamer

    Dreamer

    Joined:
    Mar 8, 2011
    Posts:
    67
    Two questions:
    - When is it going to be supported on Mobile?
    - When is it going to be a sale?

    And why did you raise the price? I still kept an eye on this asset. Why?
     
  39. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Hi, to answer your questions:
    • Mobile support is not planned for the moment
    • I'll apply for this asset to be put on sale, but when or if that happens is decided by the Asset Store team themselves
    I raise the price every time I add new functionality, since the complexity is increased and maintaining the asset becomes more time consuming ;)
     
  40. Dreamer

    Dreamer

    Joined:
    Mar 8, 2011
    Posts:
    67
    If price should be raised everytime for new functionality, then NGUI will be 98,880 USD now. Besides, new functionality for this asset? Seriously, fixing bug and improve how it works is not new functionality. That's gredy.
    Trace back to mobile support issue, it's been years. And now you still say not planned for the "moment" ? That's trying to cheat people by giving fake promise.
     
  41. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    If you believe the price is unfair, or require mobile support, feel free to buy another asset or write your own implementation :)
     
  42. ModSimTeam

    ModSimTeam

    Joined:
    Sep 9, 2012
    Posts:
    7
    We’re having problems with the line of sight tool working on some terrains. In the attached image, the line of sight is coming from the sphere near the bottom of the image which should cover everything to right. Instead, there are these large areas that are supposedly aren’t covered (even directly below the LOS Source). The sources are 2 meters above the terrain.


    Is there something we could try to fix this problem? It appears to work better if the camera is looking from an angle instead of directly down.

     
  43. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    Could you post a screenshot from inside the editor scene window showing how you set up the LOS source cameras?

    Are you using a single camera, or the 360 prefab? If you're using a single camera, it should not be looking down, but it should be looking at the horizon.
     
  44. kachuue

    kachuue

    Joined:
    Aug 9, 2017
    Posts:
    4
    hi this asset is awesome.
    but I am in two problems now.
    it is a fun game to draw images using this asset.
    it is so ideal when viewed from the front like the following screenshot, but when viewed from the side, the image looks distorted. I think this is a shader problem.

    1_original_Image.PNG
    (orisiginal image)
    1_Seen_from_side_Image.PNG
    (Obliquely viewed image)



    the other problem is that the image being drawn is drawn beyond the wall.
    i think it will be understood immediately from the following screenshot (the image is also torn in this image)
    2_Image _between_mesh.PNG
    (Images painted on wall and floor)
    2_look_over_the_wall_image.PNG
    (image look over wall)


    How do you solve these problems?
     
  45. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    How are you drawing the images?

    This is not what the asset was designed for, so I'm not sure if I can help you solve this problem.
     
  46. kachuue

    kachuue

    Joined:
    Aug 9, 2017
    Posts:
    4
    Thanks for the quick reply.

    How to draw is simple. I just put an image into the texture of LOS Source Componenet.

    It looks good from a distance. But from a close view, it looks like a screenshot above.

    I want to fix this part because my game needs to be seen from close.
     
  47. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    The LOSSource component does not have a texture property, so I'm not sure what you mean.

    Could you post a screenshot of the editor's inspector window, showing how the components are set up?
     
  48. kachuue

    kachuue

    Joined:
    Aug 9, 2017
    Posts:
    4
    Sorry for late.
    If you do not have a texture field in the LOSSource, it probably to be a custom.

    LOSSource.Texture is passed as a parameter to LOSMask.RenderSourceToMask() and passed to the shader.

    And I have tested it by version.
    The current project is in progress with version 5.4.3.f1. Tearing occurs in this version.
    I tested it in version 2017.4.0.f1, and it came out neatly with no tear in this version. But the image was also drawn in the air.

    Is the version really the problem?
    Or is there something I'm missing?
     
    Last edited: Apr 2, 2018
  49. Tycho

    Tycho

    Joined:
    Nov 24, 2012
    Posts:
    205
    The texture that should be passed into the RenderSourceToMask function is the LOSMask component’s mask render texture (created in the OnRenderImage function), not a texture assigned to the LOSSource.

    It seems like you’re using a modified version of the asset, that is using it for a purpose it was never intended for, so I’m afraid I can’t offer you any support.

    This asset is designed to render line of sight visibility, and not to project textures onto an environment. You might want to use a projector or light cookie instead.
     
  50. kachuue

    kachuue

    Joined:
    Aug 9, 2017
    Posts:
    4
    I found the cause of the Tearing
    It was the distance from the camera on Unity.
    If it gets close to a certain distance, the tearing phenomenon becomes big.
    I solved the problem by increasing the size of the world and by making the unit of distance on the unity larger.

    I'm obviously using the wrong asset, but this seems to me the best.
    I am grateful and sorry.
     
    Tycho likes this.