[Shader Help] Using stencil buffer in post processing shader?
Yo. I'm trying to have a post processing effect use the stencil buffer but I just can't seem to get it to work. The stencil mask works.
![image](http://makegamessa.com/uploads/FileUpload/7e/235b00cef93da30178930e3c5dfde8.gif)
Now, what I'd like to do is have a post processing effect that gray scales everything inside/outside of the stencil mask. I've got a simple gray scale post processing effect using Graphics.Blit
![image](http://makegamessa.com/uploads/FileUpload/ce/aa0be08682dcefae8324461c192a2f.gif)
But everytime I try to use a stencil read in the shader it's just a black screen.
If I change the it to **Ref 0** everything is shown. It doesn't work because it seems like the buffer is cleared. I've tried this and this but I just can't get it to work. Anyone have any ideas how to fix this?
Ultimately, I'm trying to make this effect.
![image](http://makegamessa.com/uploads/FileUpload/a8/3132bb9e7030c73b4528eacae8b193.gif)
Using Unity 2019.1.0f1
![image](http://makegamessa.com/uploads/FileUpload/7e/235b00cef93da30178930e3c5dfde8.gif)
Now, what I'd like to do is have a post processing effect that gray scales everything inside/outside of the stencil mask. I've got a simple gray scale post processing effect using Graphics.Blit
![image](http://makegamessa.com/uploads/FileUpload/ce/aa0be08682dcefae8324461c192a2f.gif)
But everytime I try to use a stencil read in the shader it's just a black screen.
Stencil { Ref 1 Comp Equal }
If I change the it to **Ref 0** everything is shown. It doesn't work because it seems like the buffer is cleared. I've tried this and this but I just can't get it to work. Anyone have any ideas how to fix this?
Ultimately, I'm trying to make this effect.
![image](http://makegamessa.com/uploads/FileUpload/a8/3132bb9e7030c73b4528eacae8b193.gif)
Using Unity 2019.1.0f1
![](https://makegamessa.com/utility/thumbnail/5261/FileUpload/7e/235b00cef93da30178930e3c5dfde8.gif)
![](https://makegamessa.com/utility/thumbnail/5261/FileUpload/7e/235b00cef93da30178930e3c5dfde8.gif)
monaco-1.gif
961 x 504 - 1M
![](https://makegamessa.com/utility/thumbnail/5262/FileUpload/ce/aa0be08682dcefae8324461c192a2f.gif)
![](https://makegamessa.com/utility/thumbnail/5262/FileUpload/ce/aa0be08682dcefae8324461c192a2f.gif)
monaco-2.gif
961 x 504 - 1M
![](https://makegamessa.com/utility/thumbnail/5263/FileUpload/a8/3132bb9e7030c73b4528eacae8b193.gif)
![](https://makegamessa.com/utility/thumbnail/5263/FileUpload/a8/3132bb9e7030c73b4528eacae8b193.gif)
monaco.gif
873 x 434 - 7M
Comments
Shows a little from the back end
So, I still have a stencil mask mesh. Then I duplicate that mask mesh and give it a separate layer, that's rendered to a render texture. That render texture is then fed into the grayscale post effect.
@dark_seth are you referring to the cracking platforms? One white and one gray texture? Could you elaborate.