Hello Dec1234!
Yes, I was also very happy to see that they added the custom stencil buffer!
It seems to be enough at first glance, but it is unfortunately quite limited in what you can do with it. The resolution as far as I can see only supports one byte as you said, which makes applications some applications impossible.
Some other sample things that cannot be done could include for example (just off the top of my head):
- Pick buffers (using a custom buffer for mouse selection for example)
- Complex techniques that require per vertex or other regional output
- Scenarios where you have need for more than 256 unique colors
- Gradienting
“but I can’t quite think if it’d have enough advantages over the Custom Stencil method.”
Well, it is much less about one vs. the other, it is just about what is enough for a particular method or algorithm. The project I’m working on right now for example will not work with only the stencil buffer.
Most of the techniques I mention in bullet point up there though could be achieved simply by extending the pixelformat size of the stencil buffer, but I also have this side project as an intro into how to add other buffers in general and how the renderer works.
The problem with this is that it is actually part of the depth buffer! They basically changed the depth buffer from what I assume was a 32bit format to a 24bit-depth 8bit-stencil combined buffer. So if you would like to just change that implementation you would get a lower precision/range depth buffer. I hope you see my dilemma
If you just want differently colored outlines though, the stencil buffer will be enough for most scenarios
Just for the fun of it, I’m fiddling a bit right now with seeing if I can get the depthbuffer to be written to a 64bit pixel format (32bit depth, 32bit stencil). That might solve my problem partially, but I’m guessing I would have to change quite a lot of shader code for that. But then again, maybe not. I’ll probably fiddle with it this evening. If I get it working I’ll be sure to post
Best regards,