Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Stealth system based on lighting intensity

Discussion in 'Getting Started' started by Ahronsilv, Jun 16, 2019.

  1. Ahronsilv

    Ahronsilv

    Joined:
    Jun 16, 2019
    Posts:
    13
    Hello. Sorry, if this is kinda newbie question. I want to create a stealth system based on how intense character lit is. For example, we have a wall and a light source behind. So the wall gives a shadow, and enemy is unable to see the character unless he comes out of the shadow.

    So this is based on lighting intensity. And I am kinda lost about realization. Probably any advices how to find out the amount of light that falls on the character? Or should I use something else like triggers? I am kinda discouraged about using triggers for this, though.

    Thanks eveyone.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
  3. Well, I was planning a 3D game with real stealth (light-based) system, but eventually I gave up the idea.
    I have talked with a couple of more experienced graphics developers and all of them told me that measuring the falling light onto an object during rendering is virtually impossible.
    The best solutions would be:
    - having lighting volumes, so kinda' build your shadows/lighted areas by hand
    - raycasting either from the character to nearby light sources or from the light sources to the character

    There are many pros and cons of these methods, which I won't go deep right now, but eventually the best solution for me would be the ray casting from the character to the light sources with some extra math (because of the nature of the light, the ray do not have to hit the light source straight, sometimes it's enough to hit just near a light source).