Outline shader: should be seen through some object but not when other object is between first object and shaded.
Hi,
I've written a simple shader to draw an outline around objects and that outline must be seen through some objects and not some others.
The blocking object have a higher render queue than the shader so the outline is hidden, but as soon as a non-blocking object is above a blcking object, you can see the outline again while it should be blocked by the first object.
see:
The green cube is a non-blocking object, the outline is visible. The red cube is a blocking object, the outline is not visible, but when the non-blocking green cube is above the red cube then the outline is visible again while ideally it should not appear under the red line representing the invisible part of the red cube.
I am wondering if there is a way to achieve this by editting my original shader and without adding other custom shaders to other game objects ?
here is a link to a gist with the shader code thanks for having a look:
https://gist.github.com/Davidiio/af8e43a50b8cfecacf851e3d221dde8d
Your answer
Follow this Question
Related Questions
Glowing outline with occlusion 0 Answers
Unexpected symbol error in shader script 0 Answers
Trying outline with Shader Graph 2020 causes weird glitchy effect 0 Answers
why outline is drawed only on front side of skinned mesh render 1 Answer
Transparent water shader and problems with render queue 0 Answers