I use an postproces to tint stencil template, but it doesnot work.
It is expected that two meshes will be red.
I use an postproces to tint stencil template, but it doesnot work.
It is expected that two meshes will be red.
It’s a bit complicated because you have to create the depth/stencil texture for the post-process, so that the stencil part can be reused.
Also, you must create two post-processes, because the render target of the first one will be used as the output for the scene rendering, while the second will be used as the output of your post-process shader. You must reuse the depth/stencil texture of the first post-process when running your shader: this is done thanks to the _shareDepth
method of RenderTargetWrapper
(see line 60):
As this method is often used, I made a PR so that it is visible by the end-user. I also fixed the _depthStencilTextureWithStencil
property that should be set automatically by shareDepth
:
When this PR is merged, the code can be simplified a bit to:
perfect, thanks a lot.