- Home /
Is it possible to read light value per vertex with a shader?
I'm trying to create a specific shader effect- I have objects in my game which are invisible to the player under normal circumstances, which should have parts of their mesh (and its related shadow) become visible as light from a specific source(s) falls on it. Currently, I am achieving a rough approximation of this effect using a masked render camera in the canvas space, like this:
However, this is inaccurate due to the behavior of light occlusion and fade, and is pretty limited in flexibility. I'm hoping to, instead, create a per-pixel opacity shader that can read the brightness per-vertex on its mesh (either from a specific tagged light source, or on a special render layer) and convert that data into per-pixel visibility on the primary render layer, resulting in a "ghost" effect where the torch light falls.
Unfortunately, I'm not much of a programmer- I've been getting by fine so far with the help of Bolt and ShaderGraph, but even with my research thus far, I haven't been able to determine if it's even possible to get this kind of light data from a shader (or even screen space, if it's possible to isolate the lighting data like that?). So, rather drive myself mad chasing a potential dead end, I'd appreciate any advice at all in this shader puzzle!