I need to create a visual effect which I think is best done by reading the stencil buffer from a postprocessing shader.
I know you can create a
createDepthStencilTexture, but can I also get just the stencil?
Also, how do you check the stencil part of the texture in GLSL? All the examples I can find are just using the depth.
I’m not sure reading the stencil is supported in WebGL.
There is an extension in OpenGL (https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_stencil_texturing.txt) and it is supported out of the box in OpenGL 4+ but I can’t see it supported in WebGL (WebGLRenderingContext.texParameter[fi]() - Web APIs | MDN): the
GL_DEPTH_STENCIL_TEXTURE_MODE value is not supported by
It is not supported as far as I am aware.
Thanks guys. For now I just used a color render pass instead with a custom material.