Shader object parts discard by Shadow
Hello everyone,
I could use some help here - I am searching for a solution for a discard pixel shader on lightdata. (Find the shader below.)
We are using a vision cone in our game, to show the player the line of sight of the enemies in difficult situations.
The player can hide behind obstacles and in shadows.
We are generating Meshes that build shapes around obstacles.
In order to not show the vision cone in dark/shadow areas, we started to build a shader that discards pixels in dark areas.
Our version is not working properly, therefore, I was wondering if somebody could help as I'm not sure if our approch is going in the right way.
The usage of the blend mode is our biggest issue at the moment. However, the current formular uses blend mode to discard the pixels. This needs not to be like this (it was the only solution that came into our mind at the time).
Please find the shader attached. shader file
Furthermore, find here an image that describes what we want to reach. The pinkish area is the area where the shadow should cutoff the pixels.
If you need the cone to disappear under red-pinkish meshes, try utilising the stencil buffer to mask out pixels which are covered by another mesh