Search Unity

Line of sight replicating as in Nox(2000)?

Discussion in 'General Graphics' started by Icezman, Jan 14, 2020.

  1. Icezman

    Icezman

    Joined:
    Mar 31, 2017
    Posts:
    7
    Hello

    I was hoping someone could point me in the right direction to try and implement the TrueVision/trueSight system like in Nox, a game from 2000.

    From the wikipedia:
    "The line of sight is limited by an innovative and well-received fog of war system named "TrueSight", which dynamically blacks out portions of the screen which Jack cannot see from his current position."

    You can see it in action here:


    Basicly, the player sees everything in 360 degrees, the player can see. Everything else gets "masked"/hidden with black.

    I've been thinking maybe (constantly?) doing a 360 degree raycast but that seems pretty excessive on performance?
    Maybe some shader magic? (I don't really know a lot about shaders but if I can be pointed in the right direction I could try that approach).

    This asset seems to do the trick, I'll try to contact the developer also
    https://assetstore.unity.com/packag...ne-of-sight-field-of-view-visualization-19764


    EDIT after some more work and tutorials:


    Thanks for the fast reply! I have followed Sebastian Lague's tutorial on raycasted line of sight, it seems to work great and what I wanted up to E02.
    Only thing now is that I'm stuck on how to figure out that only the walls should get rendered.
    I followed his third video

    This is what I have after E02.

    https://icezman.itch.io/cat-true-sight-test


    This is what i have after E03:

    https://icezman.itch.io/cat-true-sight-test-black-issue

    So I really like the E02 video look I have got going on but just want everything black outside what I can see and have the objects (like walls/windows/players) etc... be visible when they enter my line of sight.. I'm breaking my head over this!

    This is what I'm going for:


    More info from Nox map editor:
     
    Last edited: Jan 19, 2020
  2. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
  3. Icezman

    Icezman

    Joined:
    Mar 31, 2017
    Posts:
    7
  4. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    I'm sure it could be made to work for a 3D isometric-ish game - perhaps rendering a top-down view of the shadows/LOS to a rendertexture, then projecting it onto 3D geometry in a shader. (Would be trickier for an isometric game with 2D assets)
     
  5. Icezman

    Icezman

    Joined:
    Mar 31, 2017
    Posts:
    7
    Thanks for the fast reply! I have followed Sebastian Lague's tutorial on raycasted line of sight, it seems to work great and what I wanted up to E02.
    Only thing now is that I'm stuck on how to figure out that only the walls should get rendered.
    I followed his third video

    This is what I have after E02.


    This is what i have after E03:


    So I really like the E02 video look I have got going on but just want everything black outside what I can see and have the objects (like walls/windows/players) etc... be visible when they enter my line of sight.. I'm breaking my head over this!

    This is what I'm going for:


    i'll put this as an edit in the OP
     
    Last edited: Jan 17, 2020
  6. Siddown

    Siddown

    Joined:
    Jun 13, 2013
    Posts:
    45


    This video might help. It creates a custom mesh based on raycasts and renders it to hide what the Player can't see.
     
  7. unity_EMpkkZjoAzwgfw

    unity_EMpkkZjoAzwgfw

    Joined:
    Feb 6, 2021
    Posts:
    1
    how you reach to it