Search Unity

Light based line of sight

Discussion in 'Shaders' started by Ekibyou, Feb 19, 2014.

  1. Ekibyou

    Ekibyou

    Joined:
    Feb 19, 2014
    Posts:
    10
    I do not have a lot of experience with shaders in any engine, but I would like to learn how to create them.

    The thing I want to create is (I presume this is) a shader that makes anything a certain light doesn't touch desaturated. The light will be placed where on the player position and rotated to where the player rotates to, essentially creating a psuedo-line of sight effect. I want to expand upon this later, but for now this will suffice.

    Could anyone assist me with this? I can't find any examples of code where you get a shadowmap that you use for a shader.

    In the end, I'd like to end up with something like this: http://tycho.terryn.be/files/LOS/
     
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    700
    What I would do is make a shader that lerps between two textures(one desaturated, one not) based on light intensity.
     
  3. Ekibyou

    Ekibyou

    Joined:
    Feb 19, 2014
    Posts:
    10
    Yeah that sounds logical. Is there a way to get a texture/map based on one (or several) selected light, instead of all lights?