I have come across shaders that can dynamically create outlines around edges based on the difference in depth of pixels. This means that pixels with less depth compared to their adjacent pixels might have a thinner outline or none at all. Examples of such renders:
https://i.sstatic.net/aBT9z.jpg
https://i.sstatic.net/9bBPP.jpg
I am intrigued by the idea of using this shader in my three.js renders, but I need to understand how to access depth data for each pixel.
The Three.js documentation mentions a depth setting:
depth - whether the drawing buffer has a depth buffer of at least 16 bits.Default is true.
However, I am unsure about what it means by the drawing buffer having a depth buffer. The image buffers I know of are pixel buffers, which do not contain depth information. How do I access this depth buffer?