Glowing outline with occlusion
I'm using this technique (the one that use command buffers) to achieve a nice glowing outline over some 2D sprites (sprite that uses MeshFilter and MeshRenderer). I'm working in 2D.
Briefly the technique works in this manner (using command buffers):
A script with a custom OnRenderImage method is attached to the camera, the script contains a list of the objects that needs to be rendered with an outline;
On a first RT1 will be rendered these objets with a plain color;
On a second RT2 a blur will be applied to the first RT1;
As last step the difference between RT2 and RT1 will be applied to the whole rendered scene.
The final result looks pretty good and it's exactly what I'm looking for.
So, what's the problem? Being applied as a post-process effect, the outline is not occluded. For example, if an object A is in front to an object B with the outline, the otuline is visible through the object A.
So I'm looking for a way to get the occlusion. Someone can give me any suggestions or suggest me other approaches?
Your answer
Follow this Question
Related Questions
2D Outline Shader working in Node Preview But not when rendering 0 Answers
Trying outline with Shader Graph 2020 causes weird glitchy effect 0 Answers
Increase thickness of outlines 0 Answers
Using a Shader and Lighting Renders a Sprite's Outline When it is Transparent 1 Answer
HIde 3D objects behind segmented pixels of 2D texture 1 Answer