You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using nested alpha masks, wrapped renderers such as Spine objects in GLoader3D can inherit a stale stencil compare value after an inner mask exits.
Example hierarchy:
component1
mask1
spine11
component12
mask2
spine21
component22
mask3
spine31
component32
mask4
spine41
spine33
spine23
spine13
spine41 should be clipped by mask1 + mask2 + mask3 + mask4.
After leaving mask4, spine33 should only be clipped by mask1 + mask2 + mask3. However, UpdateContext.LeaveClipping() restores stencilReferenceValue but does not restore stencilCompareValue, so later sibling objects may still use the compare value from the inner mask.
This can make active and visible Spine objects fail stencil test and disappear.
### Cause
EnterClipping(uint clipId, bool reversedMask) updates both:
stencilReferenceValue
stencilCompareValue
But ClipInfo only stores referenceValue, so LeaveClipping() cannot restore the previous compare value.
GoWrapper objects apply the current clipping state directly to renderer materials through ApplyClippingProperties(), which makes this stale state visible on wrapped renderers such as Spine.
### Fix
Store stencilCompareValue in ClipInfo.
Restore it in LeaveClipping() and LeavePaintingMode().
Reset active stencil state in EnterPaintingMode() so it matches the existing Reset clipping behavior.
### Test
Tested in a Unity project with nested FairyGUI masks and Spine objects. After the fix, sibling Spine objects outside an inner mask no longer inherit the inner mask stencil compare value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using nested alpha masks, wrapped renderers such as Spine objects in
GLoader3Dcan inherit a stale stencil compare value after an inner mask exits.Example hierarchy: