While testing the recording to the stencil buffer, I discovered that in the places where the masks overlap, their pixels are added together. In fact, I don’t know whether this is a mistake or not. But this is contrary to logic. Since I use the replace rule. Using this code to populate the stencil buffer.
cube.node().setAttrib(StencilAttrib.make(1, StencilAttrib.SCFAlways, StencilAttrib.SOReplace, StencilAttrib.SOReplace, StencilAttrib.SOReplace, 10, 0, 10))
sphere.node().setAttrib(StencilAttrib.make(1, StencilAttrib.SCFAlways, StencilAttrib.SOKeep, StencilAttrib.SOKeep, StencilAttrib.SOReplace, 20, 0, 20))
As a result, I get a pixel equal to 30 in the place where the sphere of the cube overlaps. I would like to clarify, is this the correct behavior?
python.zip(python.trace) (95.4 KB)