Enable per-material stencil state for Standard, PBR, and Shader materials.
A writer material uses compare: "always" + passOp: "increment-clamp" to stamp the stencil buffer where
it draws; a tester material uses compare: "equal" to draw only where the stencil is still the pass's
default reference of 0 (i.e. where the writer did NOT draw). No dynamic stencil reference is needed.
constmask = createStandardMaterial(); mask.stencil = { passOp:"increment-clamp" }; // writes 1 where it draws constmasked = createStandardMaterial(); masked.stencil = { compare:"equal" }; // draws only where stencil is still 0
enableMaterialStencil(); // ← opt-in, before registerScene awaitregisterScene(scene);
Enable per-material stencil state for Standard, PBR, and Shader materials.
A writer material uses
compare: "always"+passOp: "increment-clamp"to stamp the stencil buffer where it draws; a tester material usescompare: "equal"to draw only where the stencil is still the pass's default reference of 0 (i.e. where the writer did NOT draw). No dynamic stencil reference is needed.