帖子的机器翻译:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
基本上,遮罩交互是使用模板缓冲区实现的,遮罩写入(递增或设置非 0 的值)到模板缓冲区,遮罩对象读取模板值,并且仅在等于 0 且可见性设置为“外部遮罩”或 对于“内部掩码”,大于 0(或“==”或“>=”某个值以支持嵌套掩码层次结构)。
虽然我们不知道如何执行此操作的干净官方方法,但您需要编写或使用写入模板缓冲区的着色器。 写入操作可能会增加模板缓冲区值(请参阅文档页面此处)或将其设置为常量值,例如 1(如果在 第一掩模级。
如果其他组件可能依赖于要设置的某个模板值,那么在将模板着色器与其他蒙版组件混合时请注意潜在的副作用。
..
写完上面的帖子后,我想到的一件事是,您可能想要向模板缓冲区写入一个固定值而不是增加它,因为 Spine 骨架很容易具有重叠部分。
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Machine translation of the postings:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Basically mask interaction is implemented using the stencil buffer, masks writing (incrementing or setting a value other than 0) to the stencil buffer, masked objects reading the stencil value and only rendering when either equal to 0 with visibility set to Outside mask
or larger than 0 (or ==
or >=
a certain value to support nested mask-hierarchies) for Inside mask
.
While we don't know a clean official way how to do this, you would need to write or use a shader which writes to the stencil buffer. Likely the write operation should increment the stencil buffer value (see the documentation page here) or set it to a constant value like 1 if on the first mask-level.
Just watch out for potential side effects when mixing your stencil shader with other Mask components, if perhaps other components rely on a certain stencil value to be set.
..
One thing that came to my mind after having written the above posting is that you might want to write a fixed value to the stencil buffer and not increment it, since a Spine skeleton can easily have overlapping parts.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~