Search Unity

Question Is it possible to reveal an invisible mesh under certain lights or volumes?

Discussion in 'General Graphics' started by radarhead7, Sep 1, 2020.

  1. radarhead7

    radarhead7

    Joined:
    May 4, 2020
    Posts:
    2
    So, I'll admit I know very little when it comes to shaders, or if any of this is possible in the engine, just to get that out of the way. Also, I'm using the Universal Render Pipeline right now.

    I'm just starting a new project with pretty major usage of a flashlight by the player. Sort of inspired by the game "Darkwood", I wanted to simulate a "field of vision" effect where certain objects (say, an enemy monster) are invisible until the player's light (or another bright light source) illuminates them. I originally thought this could be achieved with render layers or masks, but the research I've done so far seems to indicate neither of those systems can be controlled in this way.

    Basically; I want to:

    1. Have an object (Sphere A) that exists freely in the world. Under normal lighting circumstances, it renders like this:

    2. When a specific light component (the player's flashlight, a static light source) affects the mesh renderer, the affected parts of the mesh and their associated shadows become visible, something like this?


    Alternatively, If performing this effect on the basis of lightmap data/raycasts is impossible, would it be possible to set up some kind of 3D volume (parented to the point within the flashlight beam) that acts similar to the UI masks, revealing invisible objects within the volume?
     
    AxGreen likes this.